示例#1
0
        public void deleteRowToolStripMenuItem(DataGridViewRow dr)
        {
            Id = dr.Cells["idCompany_Company"].Value.ToString();
            string companynumber = dr.Cells["companynumber"].Value.ToString();

            using (var myClient = new ServiceManager.ServiceSystemCompaniesClient())
            {
                try
                {
                    var comp = new ServiceManager.Companies();
                    comp.Method        = "CheckCompanyNumber";
                    comp.companynumber = companynumber;
                    comp = myClient.ManageCompanies(comp);
                    if (!comp.isBool)
                    {
                        comp.idCompany = Convert.ToInt32(Id);
                        comp.Method    = "Delete";
                        myClient.ManageCompanies(comp);
                        LogUtils.WriteToLog(" Delete Row Viewing All Customers: " + dr.Cells["companyName"].Value.ToString());
                        LogUtils.SystemEventLogsInformation(" Delete Row Viewing All Customers: " + dr.Cells["companyName"].Value.ToString());
                    }
                    else
                    {
                        LogUtils.WriteToLog(" The customer does not exist failed to delete: " + dr.Cells["companyName"].Value.ToString());
                        LogUtils.SystemEventLogsWarning(" The customer does not exist failed to delete: " + dr.Cells["companyName"].Value.ToString());
                    }
                }
                catch (FaultException ex)
                {
                    LogUtils.WriteToLog(string.Format(" Failed delete Customer: {0} Exception: {1} ", dr.Cells["companyName"].Value.ToString(), ex.Message));
                    LogUtils.SystemEventLogsError(string.Format(" Failed delete Customer: {0}  Exception: {1} ", dr.Cells["companyName"].Value.ToString(), ex.Message));
                }
            }
        }
示例#2
0
 private void btnupdate_Click(object sender, EventArgs e)
 {
     using (var myComp = new ServiceManager.ServiceSystemCompaniesClient())
     {
         try
         {
             var comp = new ServiceManager.Companies();
             comp.Method        = "CheckCompanyNumber";
             comp.companynumber = this.CompanyNumber;
             comp = myComp.ManageCompanies(comp);
             if (!comp.isBool)
             {
                 comp.companyName   = CompanyName;
                 comp.contactName   = PrivateName;
                 comp.mobilePhone   = Mobile;
                 comp.email         = Email;
                 comp.Phone         = Phone;
                 comp.FAX           = Fax;
                 comp.companynumber = CompanyNumber;
                 comp.address       = Address;
                 comp.city          = City;
                 comp.ZIP           = ZipNum;
                 comp.PostalNum     = PostalNum;
                 comp.paymentTerms  = PaymentTerms;
                 comp.idCompany     = Convert.ToInt32(FromManageViewingAllCustomers.Id);
                 comp.Method        = "Update";
                 myComp.ManageCompanies(comp);
                 MessageUtils.LogUtils.WriteToLog("  Update the Customer: " + CompanyName);
                 MessageUtils.LogUtils.SystemEventLogsInformation(" Update the Customer: " + CompanyName);
                 new MessageUtils.MessageBoxText(string.Format(" לקוח עודכן בהצלחה: {0}", CompanyName)).OkMessaageBox();
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 MessageUtils.LogUtils.WriteToLog(" Customer does not exist: " + CompanyName);
                 MessageUtils.LogUtils.SystemEventLogsWarning(" Customer does not exist: " + CompanyName);
                 new MessageUtils.MessageBoxText(string.Format(" Customer does not exist: {0}", CompanyName)).OkMessaageBox();
                 this.DialogResult = DialogResult.OK;
             }
         }
         catch (FaultException ex)
         {
             MessageUtils.LogUtils.WriteToLog(string.Format(" Error Update Customer: {0} Exception: {1}", CompanyName, ex.Message));
             MessageUtils.LogUtils.SystemEventLogsError(string.Format(" Error Update Customer: {0} Exception: {1}", CompanyName, ex.Message));
         }
     }
     this.Close();
 }
示例#3
0
 public DataTable GetAllCustomers()
 {
     using (var ds = new DataSet())
     {
         using (var myClient = new ServiceManager.ServiceSystemCompaniesClient())
         {
             try
             {
                 var comp = new ServiceManager.Companies();
                 // comp.Method = "GetCompanies";
                 //comp = myClient.ManageCompanies(comp);
                 // comp.Method = "GetCompaniesDataTable";
                 comp.Method = "GetCompaniesDataSet";
                 comp        = myClient.ManageCompanies(comp);
                 // string stringValue = comp.stringData;
                 // StringReader reader = new StringReader(stringValue);
                 // ds.ReadXml(reader);
                 //return ds.Tables["Companies"];
                 //return comp.EmployeeTable;
                 return(comp.EmployeeDataSet.Tables[0]);
             }
             catch (FaultException ex)
             {
                 LogUtils.WriteToLog(string.Format(" Failed Get Companies. Exception: {0} ", ex.Message));
                 LogUtils.SystemEventLogsError(string.Format(" Failed Get Companies. Exception: {0} ", ex.Message));
                 return(null);
             }
         }
     }
 }
 public void InitcombListCompany()
 {
     if (IsForSpecificCompany)
     {
         combListCompany.Items.Clear();
         IDToName comp = new IDToName(this._companyName, this.CompanyId);
         combListCompany.Items.Add(comp);
     }
     else
     {
         using (var companyService = new ServiceManager.ServiceSystemCompaniesClient())
         {
             var comp = new ServiceManager.Companies();
             comp.Method = "GetAllCustomersToDropDown";
             comp        = companyService.ManageCompanies(comp);
             foreach (var listComp in comp.list)
             //foreach (var listComp in CompanyServices.Instance.GetAllCustomersToDropDown())
             {
                 string   companyName = listComp.Item1;
                 string   idCompany   = listComp.Item2.ToString();
                 IDToName company     = new IDToName(companyName, idCompany);
                 combListCompany.Items.Add(company);
             }
         }
     }
     if (combListCompany.Items.Count > 0)
     {
         combListCompany.SelectedIndex = 0;
     }
 }
示例#5
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (var myComp = new ServiceManager.ServiceSystemCompaniesClient())
     {
         try
         {
             var comp = new ServiceManager.Companies();
             comp.Method        = "CheckCompanyNumber";
             comp.companynumber = this.CompanyNumber;
             comp = myComp.ManageCompanies(comp);
             if (comp.isBool)
             {
                 comp.companyName   = CompanyName;
                 comp.contactName   = PrivateName;
                 comp.mobilePhone   = Mobile;
                 comp.email         = Email;
                 comp.Phone         = Phone;
                 comp.FAX           = Fax;
                 comp.companynumber = CompanyNumber;
                 comp.address       = Address;
                 comp.city          = City;
                 comp.ZIP           = ZipNum;
                 comp.PostalNum     = PostalNum;
                 comp.paymentTerms  = PaymentTerms;
                 comp.Method        = "Insert";
                 myComp.ManageCompanies(comp);
                 MessageUtils.LogUtils.WriteToLog(" Add Customer: " + CompanyName + " PostalNum:  " + PostalNum);
                 MessageUtils.LogUtils.SystemEventLogsInformation(" Add Customer: " + CompanyName + " PostalNum:  " + PostalNum);
                 new MessageUtils.MessageBoxText(string.Format(" לקוח נוסף בהצלחה: {0}", CompanyName)).OkMessaageBox();
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }
             else
             {
                 MessageUtils.LogUtils.WriteToLog(" Customer exist: " + CompanyName);
                 MessageUtils.LogUtils.SystemEventLogsInformation(" Customer exist: " + CompanyName);
                 new MessageUtils.MessageBoxText(string.Format(" לקוח קיים במערכת: {0}", CompanyName)).OkMessaageBox();
             }
         }
         catch (FaultException ex)
         {
             MessageUtils.LogUtils.WriteToLog(string.Format("Error Insert Customer: {0} Exception: {1}", CompanyName, ex.Message));
             MessageUtils.LogUtils.SystemEventLogsError(string.Format("Error Insert Customer: {0} Exception: {1}", CompanyName, ex.Message));
         }
     }
 }
        public void InitcombListCustomers()
        {
            if (IsForSpecificCustomer)
            {
                combListCust.Items.Clear();
                IDToName comp = new IDToName(this._companyName, this.CompanyId);
                combListCust.Items.Add(comp);
            }
            else
            {
                string idComp   = string.Empty;
                string Compname = string.Empty;
                using (var servicCompany = new ServiceManager.ServiceSystemCompaniesClient())
                {
                    try
                    {
                        var comp = new ServiceManager.Companies();
                        comp.Method = "GetAllCustomersToDropDown";
                        comp        = servicCompany.ManageCompanies(comp);

                        foreach (var listComp in comp.list)
                        {
                            Compname = listComp.Item1;
                            idComp   = listComp.Item2.ToString();
                            IDToName company = new IDToName(Compname, idComp);
                            combListCust.Items.Add(company);
                        }
                    }
                    catch (FaultException ex)
                    {
                        MessageUtils.LogUtils.WriteToLog(String.Format(" Error Get All Customers To DropDown: {0}", ex.Message));
                        MessageUtils.LogUtils.SystemEventLogsError(String.Format(" Error Get All Customers To DropDown: {0}", ex.Message));
                    }
                }
            }
            if (combListCust.Items.Count > 0)
            {
                combListCust.SelectedIndex = 0;
            }
        }
 private void InitializeListCustomers()
 {
     if (IsForSpecificServiceCalls)
     {
         combListCustomers1.Items.Clear();
         IDToName customers = new IDToName(this._companyName, this.IdCompany);
         combListCustomers1.Items.Add(customers);
     }
     else
     {
         using (var companyService = new ServiceManager.ServiceSystemCompaniesClient())
         {
             try
             {
                 var comp = new ServiceManager.Companies();
                 comp.Method = "GetAllCustomersToDropDown";
                 comp        = companyService.ManageCompanies(comp);
                 foreach (var item in comp.list)
                 {
                     CompanyName    = item.Item1;
                     this.IdCompany = item.Item2.ToString();
                     IDToName company = new IDToName(this.CompanyName, this.IdCompany);
                     combListCustomers1.Items.Add(company);
                 }
             }
             catch (FaultException ex)
             {
                 LogUtils.WriteToLog(string.Format(" Error Get All Customers To DropDown. Exception: {0}", ex.Message));
                 LogUtils.SystemEventLogsError(string.Format(" Error Error Get All Customers To DropDown. Exception: {0}", ex.Message));
             }
         }
         if (combListCustomers1.Items.Count > 0)
         {
             combListCustomers1.SelectedIndex = 0;
         }
     }
 }