Dharti Ratani(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam-open_document_and_partner-dhr
into lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam.
Requested reviews:
Avadhesh (openerp) (avp-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-outlook.net-jam-open_document_and_partner-dhr/+merge/75302
hello Sir,
I have made changes in open document,open partner,getobjects and create
document in the openerpconnect.cs file.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-outlook.net-jam-open_document_and_partner-dhr/+merge/75302
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam.
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Cache.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/ConfigManager.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/ConfigManager.cs 2011-09-09 05:19:07 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/ConfigManager.cs 2011-09-14 05:33:58 +0000
@@ -10,16 +10,18 @@
{
public class ConfigManager
{
+
- private string[] combodb_val;
- public string[] GetDB()
+
+ private string document_list = "res.partner," + "account.invoice," + "product.product," + "sale.order," + "crm.lead";
+ public string GetDocument()
{
- return combodb_val;
+ return document_list;
}
- public void SetDB(string[] dbval)
+ public void SetDocument(string document_val)
{
- combodb_val = dbval;
+ document_list = document_val;
}
private string server = "localhost";
@@ -174,6 +176,11 @@
else if (parts[i] == "lastdb")
this.databse = parts[i + 1].Trim();
+ else if (parts[i] == "document_list")
+ {
+
+ this.document_list = parts[i + 1].Trim();
+ }
}
}
@@ -201,7 +208,7 @@
Directory.CreateDirectory(filepath);
}
filepath = Path.Combine(filepath, "openerp.ini");
- string[] data = {"server="+this.server,"port="+ this.port.ToString(),"protocol="+ this.protocol, "username="+ this.user_name,"webserver="+this.webserver,"webport="+this.webport.ToString(),"webprotocol="+this.webprotocol,"lastdb="+this.databse };
+ string[] data = {"server="+this.server,"port="+ this.port.ToString(),"protocol="+ this.protocol, "username="+ this.user_name,"webserver="+this.webserver,"webport="+this.webport.ToString(),"webprotocol="+this.webprotocol,"lastdb="+this.databse,"document_list="+this.document_list };
File.WriteAllLines(filepath, data);
}
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Connect.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Connect.cs 2011-09-07 06:07:59 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Connect.cs 2011-09-14 05:33:58 +0000
@@ -209,7 +209,7 @@
catch (Exception ex)
{
- System.Windows.Forms.MessageBox.Show("Sorry!Partner does not exist.\n Please create partner.");
+ System.Windows.Forms.MessageBox.Show("Partner with particular email id does not exist.\nPlease creste partner.");
}
}
void btn_open_document_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
@@ -223,8 +223,17 @@
if (selection is outlook.MailItem)
{
mi = (outlook.MailItem)selection;
- string message_id = Tools.Getmessage_id(mi);
- Cache.openerpconnect.OpenDocument(message_id.ToString());
+
+ if (mi.Attachments.Count > 0)
+ {
+ for (int i = 1; i <= mi.Attachments.Count; i++)
+ {
+ mi.Attachments[i].SaveAsFile(@"C:\Users\user\AppData\" + mi.Attachments[i].FileName);
+ }
+ }
+
+ string message_id = Tools.Getmessage_id(mi);
+ Cache.openerpconnect.OpenDocument(message_id);
}
mi = null;
}
@@ -233,7 +242,7 @@
catch (Exception ex)
{
- System.Windows.Forms.MessageBox.Show("Sorry!");
+ System.Windows.Forms.MessageBox.Show("Please select any one mail item" );
}
}
void btn_open_push_mail_form_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPConnect.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPConnect.cs 2011-09-09 07:11:07 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPConnect.cs 2011-09-14 05:33:58 +0000
@@ -5,7 +5,6 @@
using System.Collections;
using System.Web;
using System.Web.Caching;
-using System.Windows.Forms;
using CookComputing.XmlRpc;
using outlook = Microsoft.Office.Interop.Outlook;
@@ -62,13 +61,14 @@
{
ArrayList ssParamLst = new ArrayList();
+ ArrayList readFromIds = new ArrayList();
int uid = Login();
string webservice_url = this.url + "/xmlrpc/object";
XMLRPCConnect rpcclient = new XMLRPCConnect(webservice_url.ToString());
ArrayList lstFilters = new ArrayList();
String[] condition = new String[] { "email", "=", email_id};
lstFilters.Add(condition);
- Object[] resSearch = rpcclient.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "res.partner", "search", lstFilters.ToArray());
+ Object[] resSearch = rpcclient.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "res.partner", "search", lstFilters.ToArray());
string weburl_string = this.weburl + "/openerp/form/view?model=res.partner&id=";
string encode_url = HttpUtility.UrlEncode(weburl_string + resSearch[0]);
string decode_url = HttpUtility.UrlDecode(encode_url);
@@ -78,67 +78,78 @@
public object [] OpenDocument(string message_id)
{
- //Method to open document attached in a url.returns the model_id and res_id of the document
- int uid = Login();
- string webservice_url = this.url + "/xmlrpc/object";
- ArrayList attach = new ArrayList();
- ArrayList readFromIds = new ArrayList();
- ArrayList selectFields = new ArrayList();
- XmlRpcStruct obj;
- Hashtable hashtable = new Hashtable();
- XMLRPCConnect rpcclient = new XMLRPCConnect(webservice_url.ToString());
- XMLRPCConnect rpcclient_read = new XMLRPCConnect(webservice_url.ToString());
- object omissing = System.Reflection.Missing.Value;
- String[] condition = new String[] { "message_id", "=", message_id };
- Object[] resSearch = rpcclient.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "mailgate.message", "search", attach.ToArray());
- readFromIds.Add(resSearch[0]);
- selectFields.Add("res_id");
- selectFields.Add("model");
- Object[] resRead = rpcclient_read.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "mailgate.message", "read", readFromIds.ToArray(), selectFields.ToArray());
-
- foreach (Object db in resRead)
+ try
{
- obj = (XmlRpcStruct)db;
-
- foreach (DictionaryEntry d in obj)
+
+ //Method to open document attached in a url.returns the model_id and res_id of the document
+ int uid = Login();
+ string webservice_url = this.url + "/xmlrpc/object";
+ ArrayList attach = new ArrayList();
+ ArrayList readFromIds = new ArrayList();
+ ArrayList selectFields = new ArrayList();
+ XmlRpcStruct obj;
+ Hashtable hashtable = new Hashtable();
+ XMLRPCConnect rpcclient = new XMLRPCConnect(webservice_url.ToString());
+ XMLRPCConnect rpcclient_read = new XMLRPCConnect(webservice_url.ToString());
+ object omissing = System.Reflection.Missing.Value;
+ String[] condition = new String[] { "message_id", "=", message_id };
+ attach.Add(condition);
+ Object[] resSearch = rpcclient.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "mailgate.message", "search", attach.ToArray());
+ readFromIds.Add(resSearch[0]);
+ selectFields.Add("res_id");
+ selectFields.Add("model");
+ Object[] resRead = rpcclient_read.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "mailgate.message", "read", readFromIds.ToArray(), selectFields.ToArray());
+
+ foreach (Object db in resRead)
{
- hashtable.Add(d.Key, d.Value);
- string web_url = this.url + "/openerp/form/view?model=mailgate.message&id=";
+ obj = (XmlRpcStruct)db;
+ foreach (DictionaryEntry d in obj)
+ {
+ hashtable.Add(d.Key, d.Value);
+ string web_url = this.url + "/openerp/form/view?model=mailgate.message&id=";
+ }
+ string modelurl_string = this.weburl + "/openerp/form/view?model=";
+ string encode_url = HttpUtility.UrlEncode(modelurl_string.ToString() + hashtable["model"]);
+ encode_url += HttpUtility.UrlEncode("&id=" + hashtable["res_id"]);
+ string decode_url = HttpUtility.UrlDecode(encode_url);
+ System.Diagnostics.Process.Start(decode_url);
+
}
-
- string modelurl_string = this.weburl + "/openerp/form/view?model=";
- string encode_url = HttpUtility.UrlEncode(modelurl_string.ToString() + hashtable["model"]);
- encode_url = encode_url + HttpUtility.UrlEncode(modelurl_string.ToString() + "&id=" + hashtable["res_id"]);
- string decode_url = HttpUtility.UrlDecode(encode_url);
- System.Diagnostics.Process.Start(decode_url);
-
- }
- return new object [] {hashtable["model"], hashtable["res_id"]};
+ return new object[] { hashtable["model"], hashtable["res_id"] };
+ }
+
+ catch (Exception ex)
+ {
+ System.Windows.Forms.MessageBox.Show("Document does not exist in the database.\n Need to create document first.");
+ return null;
+ }
}
- public ArrayList Search_Object(string model_name, string domain)
+ public ArrayList Search_Object(string model_name)
{
int uid = Login();
- String[] condition ;
+ string webservice_url = this.url + "/xmlrpc/object";
+ XMLRPCConnect rpcclient = new XMLRPCConnect(webservice_url.ToString());
+ XmlRpcStruct obj;
ArrayList arrlstObj = new ArrayList();
- string webservice_url = this.url + "/xmlrpc/object";
- if (domain != "")
- {
- condition = new String[] { "name", "ilike", domain };
- arrlstObj.Add(condition);
- }
- XMLRPCConnect rpcclient = new XMLRPCConnect(webservice_url.ToString());
ArrayList readFromIds = new ArrayList();
ArrayList selectFields = new ArrayList();
ArrayList partner_list = new ArrayList();
Object[] resSearch_partner = rpcclient.Execute(this.dbname, uid, this.pwd, model_name, "search", arrlstObj.ToArray());
readFromIds.AddRange(resSearch_partner);
+ //selectFields.Add("name");
+ //System.Windows.Forms.MessageBox.Show("hello" + readFromIds.ToString());
Object[] resRead = rpcclient.Execute(this.dbname, uid, this.pwd, model_name, "name_get", readFromIds.ToArray());
+ //System.Windows.Forms.MessageBox.Show("afternamegate"+resRead.Count());
foreach (Object[] db in resRead)
{
+ //System.Windows.Forms.MessageBox.Show("read" + db[1].ToString());
string id = db[0].ToString();
string name = db[1].ToString();
+ //System.Windows.Forms.MessageBox.Show("obj"+id+name);
+
+
partner_list.Add(new OpenObject(long.Parse(id), name, model_name));
}
@@ -194,9 +205,9 @@
ArrayList readFromIds = new ArrayList();
ArrayList selectFields = new ArrayList();
XmlRpcStruct obj;
- Object[] resSearch = rpcclient.Execute(this.dbname, uid, this.pwd, "ir.model", "search", ids.ToArray());
+ Object[] resSearch = rpcclient.Execute(this.dbname, uid, this.pwd, "ir.model", "search", ids.ToArray());
readFromIds.AddRange(resSearch);
- selectFields.Add("model");
+ selectFields.Add("name");
Object[] resRead = rpcclient_read.Execute(this.dbname, uid, this.pwd, "ir.model", "read", readFromIds.ToArray(), selectFields.ToArray());
foreach (Object db in resRead)
{
@@ -205,21 +216,19 @@
foreach (DictionaryEntry d in obj)
{
if (d.Value is String)
- {
- if (d.Value.Equals("crm.lead") || d.Value.Equals("project.issue") || d.Value.Equals("hr_recruitment"))
- {
+ {
+ if (d.Value.Equals("crm.lead") || d.Value.Equals("Project Issue") || d.Value.Equals("Applicant"))
+ {
obj_list.Add(d.Value);
}
- }
+ }
}
}
-
+
return obj_list;
-
}
-
public void AttachMailToPartner(outlook.MailItem mail, string selected_value, string model_name)
{
int uid = Login();
@@ -242,35 +251,16 @@
ArrayList module_list = new ArrayList();
frm_openerp_configuration config = new frm_openerp_configuration();
string[] condition = new string[] { "model", "=", model_name };
- ids.Add(condition);
- //System.Windows.Forms.MessageBox.Show("helostart"+ids[0]);
+ ids.Add(condition);
ArrayList readFromIds = new ArrayList();
- ArrayList selectFields = new ArrayList();
- //XmlRpcStruct obj;
+ ArrayList selectFields = new ArrayList();
Object[] resSearch = rpcclient.Execute(this.dbname, uid, this.pwd, "ir.model", "search", ids.ToArray());
System.Windows.Forms.MessageBox.Show("Not Installed" + resSearch.Count());
if (resSearch.Count() == 0)
{
System.Windows.Forms.MessageBox.Show("Not Installed");
}
- /*readFromIds.AddRange(resSearch);
- selectFields.Add("modules");
- System.Windows.Forms.MessageBox.Show("helo"+resSearch[0]);
- Object[] resRead = rpcclient_read.Execute(this.dbname, uid, this.pwd, "ir.model", "read", readFromIds.ToArray(), selectFields.ToArray());
- System.Windows.Forms.MessageBox.Show("module" + resRead[0]);
- foreach (Object db in resRead)
- {
- System.Windows.Forms.MessageBox.Show("db" + db.ToString());
- obj = (XmlRpcStruct)db;
- foreach (DictionaryEntry d in obj)
- {
- System.Windows.Forms.MessageBox.Show("helo"+d.Value);
-
- }
-
- }
- //return obj_list;*/
-
+
}
public ArrayList GetAllCountry()
{
@@ -369,8 +359,7 @@
ArrayList lstFilters = new ArrayList();
String[] condition = new String[] { "name", "=", name };
lstFilters.Add(condition);
- addPairFields.Add("name", name);
-
+ addPairFields.Add("name", name);
int res_id = rpcclient_partner_id.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "res.partner", "create", addPairFields);
return res_id;
@@ -379,7 +368,7 @@
public void CreateContact(outlook.MailItem mi, int partner_id, string name, string email_id)
{
-
+ frm_contact contact = new frm_contact();
int uid = Login();
XmlRpcStruct addPairFields = new XmlRpcStruct();
string webservice_url = this.url + "/xmlrpc/object";
@@ -388,33 +377,59 @@
String[] condition = new String[] { "email", "=", email_id };
lstFilters.Add(condition);
Object[] resSearch = rpcclient_partner_id.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "res.partner", "search", lstFilters.ToArray());
-
+ Dictionary<string, string> dict = new Dictionary<string, string>();
+
addPairFields.Add("name", name);
addPairFields.Add("email", email_id);
-
+
int res_id = rpcclient_partner_id.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "res.partner.address", "create", addPairFields);
}
- public void CreateDocument(outlook.MailItem mail, string obj_name)
+ public object CreateDocument(outlook.MailItem mail, string obj_name)
{
try
{
-
+ ArrayList obj = new ArrayList();
+ ArrayList Field = new ArrayList();
+ ArrayList Range = new ArrayList();
+ XmlRpcStruct objc;
int uid = Login();
string webservice_url = this.url + "/xmlrpc/object";
XmlRpcStruct Fields = new XmlRpcStruct();
XMLRPCConnect rpcclient = new XMLRPCConnect(webservice_url.ToString());
+ XMLRPCConnect rpcclient_read = new XMLRPCConnect(webservice_url.ToString());
string email = Tools.GetMIME(mail);
- int resSearch = rpcclient.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "email.server.tools", "process_email",obj_name,email.ToString());
- System.Windows.Forms.MessageBox.Show("Document Created successfully ");
-
+ String[] object_name = new String[] {"name","=",obj_name };
+ obj.Add(object_name);
+ Object[] Search = rpcclient.Execute(this.dbname, uid, this.pwd, "ir.model", "search", obj.ToArray());
+ Range.Add(Search[0]);
+ Field.Add("model");
+ Object[] resRead = rpcclient_read.Execute(this.dbname, uid, this.pwd, "ir.model", "read", Range.ToArray(), Field.ToArray());
+ foreach (Object db in resRead)
+ {
+ objc = (XmlRpcStruct)db;
+
+ foreach (DictionaryEntry dict in objc)
+ {
+ if (dict.Value is String)
+ {
+ int resSearch = rpcclient.Execute(this.dbname, Convert.ToInt32(uid), this.pwd, "email.server.tools", "process_email", dict.Value.ToString(), email.ToString());
+ System.Windows.Forms.MessageBox.Show("Document Created successfully ");
+ }
+ }
+ }
+
+
+
+ return Search[0];
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Exception: "+ex);
+ return null;
}
-
+
}
}
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPOutlookPlugin.csproj' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPOutlookPlugin.csproj 2011-09-07 09:54:00 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPOutlookPlugin.csproj 2011-09-14 05:33:58 +0000
@@ -132,9 +132,11 @@
<ItemGroup>
<EmbeddedResource Include="frm_contact.resx">
<DependentUpon>frm_contact.cs</DependentUpon>
+ <SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frm_create_new_partner.resx">
<DependentUpon>frm_create_new_partner.cs</DependentUpon>
+ <SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frm_openerp_configuration.resx">
<DependentUpon>frm_openerp_configuration.cs</DependentUpon>
@@ -150,9 +152,11 @@
</EmbeddedResource>
<EmbeddedResource Include="frm_push_mail.resx">
<DependentUpon>frm_push_mail.cs</DependentUpon>
+ <SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frm_select_partner.resx">
<DependentUpon>frm_select_partner.cs</DependentUpon>
+ <SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/OpenERPOutlookPlugin.csproj.user' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Tools.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/XMLRPCConnect.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_contact.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_contact.designer.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_create_new_partner.Designer.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_create_new_partner.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.Designer.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.Designer.cs 2011-09-08 12:57:39 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.Designer.cs 2011-09-14 05:33:58 +0000
@@ -259,6 +259,7 @@
this.txt_server_config.TabIndex = 0;
this.txt_server_config.TabStop = false;
this.txt_server_config.Text = "http://localhost:8069";
+
//
// lbn_password
//
@@ -334,6 +335,7 @@
this.btnadd_doc.TabIndex = 8;
this.btnadd_doc.Text = "Add";
this.btnadd_doc.UseVisualStyleBackColor = true;
+ this.btnadd_doc.Click += new System.EventHandler(this.btnadd_doc_Click);
//
// btndelete_doc
//
@@ -352,6 +354,7 @@
this.btnloadimage.TabIndex = 6;
this.btnloadimage.Text = "Load Image";
this.btnloadimage.UseVisualStyleBackColor = true;
+ this.btnloadimage.Click += new System.EventHandler(this.btnloadimage_Click);
//
// txtimage_path
//
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.cs 2011-09-09 09:18:08 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.cs 2011-09-14 05:33:58 +0000
@@ -6,7 +6,7 @@
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
-using System.Web;
+
using System.Windows.Forms;
using CookComputing.XmlRpc;
@@ -69,8 +69,14 @@
this.getname();
}
public ListView getname()
- {
-
+ {
+ string filepath = Tools.getAppFolderPath();
+ filepath = System.IO.Path.Combine(filepath, "OpenErpOutlook");
+ filepath = Path.Combine(filepath, "openerp.ini");
+ StreamReader sr = new StreamReader(filepath);
+ string[] fileread = File.ReadAllLines(filepath);
+ char[] splt = {'='};
+ //MessageBox.Show("string" + fileread[fileread.Length - 1]);
lstviewdoc.SmallImageList = imageListSmall;
item = new ListViewItem("Partners");
@@ -145,65 +151,84 @@
this.Close();
}
+
+
+ private Image FromFile(string p)
+ {
+ throw new NotImplementedException();
+ }
+
+ private void btndelete_doc_Click(object sender, EventArgs e)
+ {
+ foreach (ListViewItem listViewItem in lstviewdoc.SelectedItems)
+ {
+ listViewItem.Remove();
+ }
+
+ }
+
+
private void btnadd_doc_Click(object sender, EventArgs e)
{
- object object_id = "";
-
- object_id = Cache.openerpconnect.GetobjectId(this.txtobject_name.Text);
-
-
- if (txtobj_title.Text == "")
- {
- System.Windows.Forms.MessageBox.Show("You Must Enter Document.");
- }
-
- if (txtobject_name.Text == "")
- {
- System.Windows.Forms.MessageBox.Show("You Must Enter Document Name.");
-
- }
-
- if (object_id != "")
- {
-
-
+ try
+ {
+
+ object object_id;
+ OpenERPConnect openerp_connect = new OpenERPConnect(url, combo_config_database.Text, txt_username.Text, txt_password.Text, txt_webserver_parameter.Text);
+ object_id = Cache.openerpconnect.GetobjectId(this.txtobject_name.Text);
+
+ if (txtobj_title.Text == "")
+ {
+ System.Windows.Forms.MessageBox.Show("You Must Enter Document.");
+ }
+
+ if (txtobject_name.Text == "")
+ {
+ System.Windows.Forms.MessageBox.Show("You Must Enter Document Name.");
+
+ }
+ if (object_id != null)
+ {
ListViewItem lstview_items = new ListViewItem(txtobj_title.Text);
lstview_items.SubItems.Add(txtobject_name.Text);
imageListSmall.Images.Add(System.Drawing.Image.FromFile(txtimage_path.Text));
-
lstview_items.ImageIndex = imageListSmall.Images.Count - 1;
-
+
lstviewdoc.SmallImageList = imageListSmall;
lstviewdoc.Items.AddRange(new ListViewItem[] { lstview_items });
this.lstviewdoc.Visible = true;
- this.ResumeLayout(false);
-
-
+ this.ResumeLayout(false);
}
txtobj_title.Clear();
txtobject_name.Clear();
txtimage_path.Clear();
- }
-
- private Image FromFile(string p)
- {
- throw new NotImplementedException();
- }
-
- private void btndelete_doc_Click(object sender, EventArgs e)
- {
- foreach (ListViewItem listViewItem in lstviewdoc.SelectedItems)
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Please login to database first");
+ this.Close();
+ }
+
+ }
+
+ private void btnloadimage_Click(object sender, EventArgs e)
+ {
+ opendialog_image.Filter = "Icon Files .ico|*.ico";
+ opendialog_image.ShowDialog();
+
+
+
+ if (opendialog_image.FileName != "")
{
- listViewItem.Remove();
+
+ txtimage_path.Text = opendialog_image.FileName;
}
}
-
-
private void btn_webserver_parameter_change_Click(object sender, EventArgs e)
{
@@ -215,12 +240,12 @@
private void btn_webserver_parameter_open_Click(object sender, EventArgs e)
{
- string encode_url = HttpUtility.UrlEncode(this.txt_webserver_parameter.Text);
- string decode_url = HttpUtility.UrlDecode(encode_url);
- System.Diagnostics.Process.Start(decode_url);
+
}
+
+
}
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_connection.Designer.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_connection.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_connection_webserver.Designer.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_connection_webserver.Designer.cs 2011-09-07 06:07:59 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_connection_webserver.Designer.cs 2011-09-14 05:33:58 +0000
@@ -84,7 +84,6 @@
this.chkssl.TabIndex = 14;
this.chkssl.Text = "SSL (https)";
this.chkssl.UseVisualStyleBackColor = true;
- this.chkssl.CheckedChanged += new System.EventHandler(this.chkssl_CheckedChanged);
//
// txt_webserver_port_change
//
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_connection_webserver.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_partner.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_partner.designer.cs' (properties changed: -x to +x)
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_push_mail.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_push_mail.cs 2011-09-09 07:11:07 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_push_mail.cs 2011-09-14 05:33:58 +0000
@@ -1,5 +1,4 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -7,6 +6,7 @@
using System.Text;
using System.Windows.Forms;
using outlook = Microsoft.Office.Interop.Outlook;
+using System.Collections;
namespace OpenERPOutlookPlugin
{
public partial class frm_push_mail : Form
@@ -15,61 +15,67 @@
public frm_push_mail()
{
InitializeComponent();
- //push_data("res.partner", "");
- ArrayList model = new ArrayList();
- model.Add("res.partner");
- populate_doc_list(model, "");
+ push_data("res.partner");
+ get_data();
}
-
- private Boolean populate_doc_list(ArrayList models, string domain)
+ //Add Partner List
+ void push_data(string model_name)
{
-
- foreach (string model in models)
+ foreach (OpenObject oo in Cache.openerpconnect.Search_Object(model_name))
{
- foreach (OpenObject oo in Cache.openerpconnect.Search_Object(model, domain))
- {
- ListViewItem item2 = new ListViewItem(oo.name);
- item2.Name = oo.id.ToString();
- item2.SubItems.Add(oo.model);
- item2.ImageIndex = 0;
- lstview_object.Items.Add(item2);
- }
+
+ //list_partner.Items.Add(oo.name);
+ ListViewItem item2 = new ListViewItem(oo.name);
+ item2.Name = oo.id.ToString();
+ item2.SubItems.Add(oo.model);
+ item2.ImageIndex = 0;
+ lstview_object.Items.Add(item2);
}
- return true;
+
}
void get_data()
{
-
foreach (object obj in Cache.openerpconnect.getobjects())
{
cmboboxcreate.Items.Add(obj);
+
}
+
}
private void btncreate_Click(object sender, EventArgs e)
{
- MessageBox.Show("create");
-
+
Microsoft.Office.Interop.Outlook.Application app = null;
try
{
+
app = new Microsoft.Office.Interop.Outlook.Application();
outlook.MailItem mi;
foreach (var selection in app.ActiveExplorer().Selection)
{
+
if (selection is outlook.MailItem)
{
+
+
mi = (outlook.MailItem)selection;
- string obj = (string)cmboboxcreate.SelectedItem;
- Cache.openerpconnect.CreateDocument(mi, obj);
+ string name = (string)cmboboxcreate.SelectedItem;
+ Cache.openerpconnect.CreateDocument(mi, name);
this.Close();
+
}
mi = null;
}
}
+
catch (Exception ex)
{
+
System.Windows.Forms.MessageBox.Show("Sorry!Document does not exist.");
}
+
+
+
}
protected void mc_CheckedChanged(object sender, EventArgs e)
@@ -78,19 +84,10 @@
if (!mc.Checked)
{
lstview_object.Items.Clear();
- //push_data("res.partner","");
- ArrayList model = new ArrayList();
- model.Add("res.partner");
- populate_doc_list(model, "");
+ push_data("res.partner");
}
else
- {
- //push_data(mc.Name,"");
- ArrayList model = new ArrayList();
- model.Add(mc.Name);
- populate_doc_list(model, "");
- }
-
+ push_data(mc.Name);
}
private void btn_attach_mail_to_partner_Click(object sender, EventArgs e)
@@ -98,11 +95,13 @@
Microsoft.Office.Interop.Outlook.Application app = null;
try
{
+
app = new Microsoft.Office.Interop.Outlook.Application();
outlook.MailItem mi;
foreach (var selection in app.ActiveExplorer().Selection)
{
+
if (selection is outlook.MailItem)
{
mi = (outlook.MailItem)selection;
@@ -121,10 +120,12 @@
Cache.openerpconnect.AttachMailToPartner(mi, item, model_name);
Cache.openerpconnect.GetModule(model_name);
}
+
}
}
this.Close();
+
}
mi = null;
}
@@ -153,6 +154,7 @@
if (selection is outlook.MailItem)
{
mi = (outlook.MailItem)selection;
+ //string item = (string)list_partner.SelectedItem;
frm_contact contact = new frm_contact(mi.SenderName, mi.SenderEmailAddress);
contact.Show();
}
@@ -164,12 +166,17 @@
private void frm_push_mail_Load(object sender, EventArgs e)
{
frm_openerp_configuration config = new frm_openerp_configuration();
+ //MessageBox.Show("messege" + config.getname().Items.Count);
+ //ArrayList strarr = new ArrayList();
int num = 5;
int s = 5;
int count = config.getname().Items.Count;
for (int index = 0; index < count; index++)
{
ListViewItem item = config.getname().Items[index];
+
+ //string name = str + "chck";
+ //CheckBox chkDynamic ;
chkDynamic = new CheckBox();
chkDynamic.Name = item.Name;
@@ -185,37 +192,23 @@
chkDynamic.Checked = true;
chkDynamic.CheckedChanged += new EventHandler(mc_CheckedChanged);
grp_chckbx_object.Controls.Add(chkDynamic);
-
}
+
Cache.openerpconnect.getobjects();
}
+
private void btn_search_Click(object sender, EventArgs e)
{
- int count = grp_chckbx_object.Controls.Count;
- string m_name;
- ArrayList list = new ArrayList();
- for (int i = 0; i < count; i++)
- {
- if (grp_chckbx_object.Controls[i].GetType() == typeof(CheckBox))
- {
- CheckBox mc = (CheckBox)grp_chckbx_object.Controls[i];
- if (mc.Checked == true)
- {
- m_name = mc.Name;
- list.Add(m_name);
- }
- }
- }
- lstview_object.Items.Clear();
- if (list.Count < 1)
- {
- MessageBox.Show("No document selected.", "Push To OpenERP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- populate_doc_list(list,this.txt_doc_search.Text);
- }
+ ListViewItem index = lstview_object.FindItemWithText(txt_doc_search.Text);
+ if (index != null)
+ {
+ index.Selected = true;
+ }
+ else
+ MessageBox.Show("No Records Found");
}
+
+
}
}
=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_push_mail.designer.cs' (properties changed: -x to +x)
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_push_mail.designer.cs 2011-09-09 07:11:07 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_push_mail.designer.cs 2011-09-14 05:33:58 +0000
@@ -149,9 +149,9 @@
//
// btn_search
//
- this.btn_search.Location = new System.Drawing.Point(340, 25);
+ this.btn_search.Location = new System.Drawing.Point(187, 25);
this.btn_search.Name = "btn_search";
- this.btn_search.Size = new System.Drawing.Size(89, 23);
+ this.btn_search.Size = new System.Drawing.Size(63, 23);
this.btn_search.TabIndex = 7;
this.btn_search.Text = "Search";
this.btn_search.UseVisualStyleBackColor = true;
@@ -181,13 +181,13 @@
this.txt_doc_search.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txt_doc_search.Location = new System.Drawing.Point(74, 28);
this.txt_doc_search.Name = "txt_doc_search";
- this.txt_doc_search.Size = new System.Drawing.Size(248, 20);
+ this.txt_doc_search.Size = new System.Drawing.Size(107, 20);
this.txt_doc_search.TabIndex = 2;
//
// lbtsrch
//
this.lbtsrch.AutoSize = true;
- this.lbtsrch.Location = new System.Drawing.Point(24, 30);
+ this.lbtsrch.Location = new System.Drawing.Point(6, 30);
this.lbtsrch.Name = "lbtsrch";
this.lbtsrch.Size = new System.Drawing.Size(44, 13);
this.lbtsrch.TabIndex = 0;
@@ -216,7 +216,7 @@
//
this.cmboboxcreate.FormattingEnabled = true;
this.cmboboxcreate.Items.AddRange(new object[] {
- "crm.lead"});
+ ""});
this.cmboboxcreate.Location = new System.Drawing.Point(103, 27);
this.cmboboxcreate.Name = "cmboboxcreate";
this.cmboboxcreate.Size = new System.Drawing.Size(85, 21);
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp