Nimesh Contractor(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam-login_validation-nco 
into lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam.

Requested reviews:
  Jigar Amin  (OpenERP) (jam-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-outlook.net-jam-login_validation-nco/+merge/74990

Hello Sir,

    If no mail Selected than Warning Message Please Select one Mail and Do not 
Load Form.

    if more than One Mail Selected, then give message Multiple mail selection 
not allowed please selected only one mail only and Do not Load Form.

    If only one mail is selected then it proceed to the next step.


Thank You.
(nco)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-outlook.net-jam-login_validation-nco/+merge/74990
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'
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Cache.cs	2011-09-07 06:07:59 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Cache.cs	2011-09-12 13:19:46 +0000
@@ -8,6 +8,7 @@
     static public  class Cache
     {
         static private OpenERPConnect _openerpconnect;
+        public static Boolean temp = false;
         static public OpenERPConnect openerpconnect
         {
             get 
@@ -16,6 +17,7 @@
             }
             set
             {
+
                 _openerpconnect = value;
             }
         }

=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/Connect.cs'
--- 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-12 13:19:46 +0000
@@ -40,9 +40,12 @@
         
 		public Connect()
 		{
-		}
-
-		/// <summary>
+
+        }
+
+        public int cnt_mail = 0;
+
+        /// <summary>
 		///      Implements the OnConnection method of the IDTExtensibility2 interface.
 		///      Receives notification that the Add-in is being loaded.
 		/// </summary>
@@ -115,8 +118,24 @@
         private office.CommandBars oCommandBars;
         private office.CommandBar menuBar;
         private office.CommandBarPopup newMenuBar;
-        
-        
+
+        public int countMail()
+        {
+            cnt_mail = 0;
+            Microsoft.Office.Interop.Outlook.Application app = null;
+            try
+            {
+                app = new Microsoft.Office.Interop.Outlook.Application();
+                foreach (var selection in app.ActiveExplorer().Selection)
+                {
+                    cnt_mail = app.ActiveExplorer().Selection.Count;
+                }
+            }
+            catch (Exception e)
+            {
+            }
+            return cnt_mail;
+        }
              
 		public void OnStartupComplete(ref System.Array custom)
 		{
@@ -174,9 +193,8 @@
                 oActiveExplorer = applicationObject.GetType().InvokeMember("ActiveExplorer", BindingFlags.GetProperty, null, applicationObject, null);
                 oCommandBars = (office.CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, oActiveExplorer, null);
             }
-
-
 		}
+
         void btn_open_configuration_form_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
         {
             frm_openerp_configuration frm_config = new frm_openerp_configuration();
@@ -186,60 +204,111 @@
         
         void btn_open_partner_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
         {
-            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;
-                        Cache.openerpconnect.OpenPartner(mi.SenderEmailAddress.ToString());
-                    }
-                    mi = null;
-                }
+            if (Cache.isLoggedIn == false)
+            {
+                MessageBox.Show("Please connect to Open-ERP to begin.");
             }
-
-            catch (Exception ex)
+            else
             {
-                
-                System.Windows.Forms.MessageBox.Show("Sorry!Partner does not exist.\n Please create partner.");
+                if (countMail() == 0)
+                {
+                    MessageBox.Show("You have not selected any mail.\n Please Select One Mail.");
+                }
+                if (countMail() > 1)
+                {
+                    MessageBox.Show("Multiple selction is Not Allowed.\n Please Select only One Mail.");
+                }
+                if (countMail() == 1)
+                {
+
+                    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;
+                                Cache.openerpconnect.OpenPartner(mi.SenderEmailAddress.ToString());
+                            }
+                            mi = null;
+                        }
+                    }
+
+                    catch (Exception ex)
+                    {
+                        System.Windows.Forms.MessageBox.Show("Sorry!Partner does not exist.\n Please create partner.");
+                    }
+                }
             }
         }
+
         void btn_open_document_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
         {
-            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 message_id = Tools.Getmessage_id(mi);
-                        Cache.openerpconnect.OpenDocument(message_id.ToString());
-                    }
-                    mi = null;
-                }
+            if (Cache.isLoggedIn == false)
+            {
+                MessageBox.Show("Please connect to Open-ERP to begin.");
             }
-
-            catch (Exception ex)
+            else
             {
-
-                System.Windows.Forms.MessageBox.Show("Sorry!");
+                if (countMail() == 0)
+                {
+                    MessageBox.Show("You have not selected any mail.\n Please Select One Mail.");
+                }
+                if (countMail() > 1)
+                {
+                    MessageBox.Show("Multiple selction is Not Allowed.\n Please Select only One Mail.");
+                }
+                if (countMail() == 1)
+                {
+                    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 message_id = Tools.Getmessage_id(mi);
+                                Cache.openerpconnect.OpenDocument(message_id.ToString());
+                            }
+                            mi = null;
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        System.Windows.Forms.MessageBox.Show("Sorry!");
+                    }
+                }
             }
         }
         void btn_open_push_mail_form_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
         {
-            frm_push_mail frm_push_mail = new frm_push_mail();
-            frm_push_mail.Show();
+            if (Cache.isLoggedIn == false)
+            {
+                MessageBox.Show("Please connect to Open-ERP to begin.");
+            }
+            else
+            {
+                if (countMail() == 0)
+                {
+                    MessageBox.Show("You have not selected any mail.\n Please Select One Mail.");
+                }
+                if (countMail() > 1)
+                {
+                    MessageBox.Show("Multiple selction is Not Allowed.\n Please Select only One Mail.");
+                }
+                if (countMail() == 1)
+                {
+                    frm_push_mail frm_push_mail = new frm_push_mail();
+                    frm_push_mail.Show();
+                }
+            }
         }
 
 		/// <summary>

=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_contact.cs'
--- outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_contact.cs	2011-09-07 06:07:59 +0000
+++ outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_contact.cs	2011-09-12 13:19:46 +0000
@@ -52,7 +52,6 @@
             {
                 this.combo_fed_state.Items.Add(state_name.ToString());
             }
-            
         }
 
         private void btncancel_Click(object sender, EventArgs e)

=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.Designer.cs'
--- 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-12 13:19:46 +0000
@@ -40,7 +40,6 @@
             this.label2 = new System.Windows.Forms.Label();
             this.pnconfig = new System.Windows.Forms.Panel();
             this.grpconfig = new System.Windows.Forms.GroupBox();
-            this.txt_dbname = new System.Windows.Forms.TextBox();
             this.combo_config_database = new System.Windows.Forms.ComboBox();
             this.btn_openerp_connect = new System.Windows.Forms.Button();
             this.txt_password = new System.Windows.Forms.TextBox();
@@ -73,6 +72,7 @@
             this.imageListSmall = new System.Windows.Forms.ImageList(this.components);
             this.btn_main_close = new System.Windows.Forms.Button();
             this.opendialog_image = new System.Windows.Forms.OpenFileDialog();
+            this.txt_dbname = new System.Windows.Forms.TextBox();
             this.tb1.SuspendLayout();
             this.tbconfigsetting.SuspendLayout();
             this.pnwebparam.SuspendLayout();
@@ -199,14 +199,6 @@
             this.grpconfig.TabStop = false;
             this.grpconfig.Text = "Application Server Parameters";
             // 
-            // txt_dbname
-            // 
-            this.txt_dbname.Location = new System.Drawing.Point(88, 74);
-            this.txt_dbname.Name = "txt_dbname";
-            this.txt_dbname.Size = new System.Drawing.Size(269, 20);
-            this.txt_dbname.TabIndex = 2;
-            this.txt_dbname.Visible = false;
-            // 
             // combo_config_database
             // 
             this.combo_config_database.AllowDrop = true;
@@ -511,6 +503,14 @@
             // 
             this.opendialog_image.FileName = "openimagedialog";
             // 
+            // txt_dbname
+            // 
+            this.txt_dbname.Location = new System.Drawing.Point(88, 74);
+            this.txt_dbname.Name = "txt_dbname";
+            this.txt_dbname.Size = new System.Drawing.Size(269, 20);
+            this.txt_dbname.TabIndex = 2;
+            this.txt_dbname.Visible = false;
+            // 
             // frm_openerp_configuration
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

=== modified file 'outlook/plugin/openerp-outlook-plugin_v2.0/OpenERPOutlookPlugin/frm_openerp_configuration.cs'
--- 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-12 13:19:46 +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;
@@ -29,31 +29,36 @@
         public string weburl;
         public ListViewItem item;
         ConfigManager cm = new ConfigManager();
-            
+        public Connect cn = new Connect();
+    
         public frm_openerp_configuration()
         {
             InitializeComponent();
-            cm.loadConfig();
+            
         }
         
-        public frm_openerp_configuration(ConfigManager cm)
+        public frm_openerp_configuration(string strparam, string strparam2)
         {
             InitializeComponent();
-            this.cm = cm;
-            this.txt_server_config.Text = cm.Getprotocol() + cm.Getserver() + ":" + cm.Getport();
-            this.txt_webserver_parameter.Text = cm.GetWebprotocol() + cm.GetWebserver() + ":" + cm.GetWebport();
+            this.txt_server_config.Text = strparam + strparam2;
         }
 
+        public frm_openerp_configuration(string weburl)
+        {
+            InitializeComponent();
+            this.txt_webserver_parameter.Text = weburl;
+        }
 
         private void frm_openerp_configuration_Load(object sender, EventArgs e)
-        {            
-  
-            this.txt_server_config.Text = cm.Getprotocol() + cm.Getserver() + ":" + cm.Getport();
-            this.txt_username.Text = cm.GetUname();
-            this.txt_webserver_parameter.Text = cm.GetWebprotocol() + cm.GetWebserver() + ":" +cm.GetWebport();
+        {
+            this.getname();
+        }
+        public ListView getname()
+        {     
+            string url = txt_server_config.Text;
             try
             {
-                XMLRPCConnect rpcclient_dblist = new XMLRPCConnect(this.txt_server_config.Text + "/xmlrpc/db");
+                XMLRPCConnect rpcclient_dblist = new XMLRPCConnect(url + "/xmlrpc/db");
                 Object[] res_dblist = rpcclient_dblist.list();
                 foreach (var selection in res_dblist)
                 {
@@ -63,13 +68,10 @@
             catch
             {
                 txt_dbname.Visible = true;
-                MessageBox.Show("visible");
                 combo_config_database.Visible = false;
+
             }
-            this.getname();
-        }
-        public ListView getname()
-        {    
+            //ImageList imageSmallList = new ImageList();
 
           
             lstviewdoc.SmallImageList = imageListSmall;
@@ -106,9 +108,9 @@
         {
             throw new NotImplementedException();
         }
-        
+
         private void btn_main_close_Click(object sender, EventArgs e)
-        {            
+        {
             this.Close();
         }
 
@@ -128,19 +130,23 @@
             }
             OpenERPConnect openerp_connect = new OpenERPConnect(url, dbname, txt_username.Text, txt_password.Text, txt_webserver_parameter.Text);
             Cache.openerpconnect = openerp_connect;
+
             if (openerp_connect.Login() != 0)
             {
+                //Connect.Equals(true);
+                Cache.temp = true;
                 System.Windows.Forms.MessageBox.Show("Successfully Login to OpenERP..");
-                cm.saveConfig();
                 this.Close();
             }
-
-
+            else
+            {
+                System.Windows.Forms.MessageBox.Show("No server running on " + this.txt_server_config + ".","", MessageBoxButtons.OK, MessageBoxIcon.Information);
+            }
         }
 
         private void btn_open_server_url_form_Click(object sender, EventArgs e)
         {
-            frm_openerp_connection openerp_connection = new frm_openerp_connection(cm);
+            frm_openerp_connection openerp_connection = new frm_openerp_connection();
             openerp_connection.Show();
             this.Close();
         }
@@ -203,26 +209,32 @@
 
         }
 
-        
+        private void btnloadimage_Click(object sender, EventArgs e)
+        {
+            opendialog_image.Filter = "Icon Files .ico|*.ico";
+            opendialog_image.ShowDialog();
+
+
+            if (opendialog_image.FileName != "")
+            {
+                txtimage_path.Text = opendialog_image.FileName;
+
+            }
+
+
+        }
         private void btn_webserver_parameter_change_Click(object sender, EventArgs e)
         {
-
-            frm_openerp_connection_webserver connect_webserver = new frm_openerp_connection_webserver(cm);
+            
+            frm_openerp_connection_webserver connect_webserver = new frm_openerp_connection_webserver();
             connect_webserver.Show();
-            cm.saveConfig();
             this.Close();
         }
 
         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);
-        }
-
-        
-       
-        }
-     
-
+
+        }
+
+     }
 }

_______________________________________________
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

Reply via email to