public void deleteRowToolStripMenuItem(DataGridViewRow dr)
 {
     using (var objServiceToCompany = new ServiceManager.ServiceSystemCompaniesClient())
     {
         var serviceCompany = new ServiceManager.ServiceToCompany();
         serviceCompany.Method    = "CheckToAdd";
         serviceCompany.idCompany = Convert.ToInt16(dr.Cells["IdCompany_Services"].Value.ToString());
         serviceCompany.idService = Convert.ToInt16(dr.Cells["idservice_Services_Company"].Value.ToString());
         serviceCompany           = objServiceToCompany.ManageServiceToCompany(serviceCompany);
         if (!serviceCompany.isBool)
         {
             serviceCompany.Method = "Delete";
             objServiceToCompany.ManageServiceToCompany(serviceCompany);
         }
     }
 }
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (var objServiceToCompany = new ServiceManager.ServiceSystemCompaniesClient())
     {
         try
         {
             var serviceCompany = new ServiceManager.ServiceToCompany();
             serviceCompany.idService = Convert.ToInt16(ServiceId);
             serviceCompany.idCompany = Convert.ToInt16(CompanyId);
             serviceCompany.Method    = "CheckToAdd";
             serviceCompany           = objServiceToCompany.ManageServiceToCompany(serviceCompany);
             if (serviceCompany.isBool)
             {
                 if (PriceCost == string.Empty)
                 {
                     PriceCost = "0";
                 }
                 serviceCompany.Startdate = Startdate;
                 serviceCompany.Enddate   = Enddate;
                 serviceCompany.Paid      = Paid;
                 serviceCompany.Price     = Price;
                 serviceCompany.priceCost = PriceCost;
                 serviceCompany.idCompany = Convert.ToInt16(CompanyId);
                 serviceCompany.idService = Convert.ToInt16(ServiceId);
                 serviceCompany.Method    = "Insert";
                 objServiceToCompany.ManageServiceToCompany(serviceCompany);
                 MessageUtils.LogUtils.WriteToLog(String.Format(" Manage Customer To Services: {0} And {1}", CompanyName, ServiceName));
                 MessageUtils.LogUtils.SystemEventLogsInformation(String.Format(" Manage Customer To Services: {0} And {1}", CompanyName, ServiceName));
                 new MessageUtils.MessageBoxText("נוסף בהצלחה").OkMessaageBox();
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 MessageUtils.LogUtils.WriteToLog(String.Format(" Error Manage Customer To Services the company and service exist: {0} And {1}", CompanyName, ServiceName));
                 MessageUtils.LogUtils.SystemEventLogsWarning(String.Format(" Error Manage Customer To Services the company and service exist: {0} And {1}", CompanyName, ServiceName));
                 new MessageUtils.MessageBoxText("קיים במערכת אותו שרות ללקוח הנבחר").OkMessaageBox();
             }
         }
         catch (FaultException ex)
         {
             MessageUtils.LogUtils.WriteToLog(String.Format(" Error Manage Customer {0} Services: {1} . Exception: {2}", CompanyName, ServiceName, ex.Message));
             MessageUtils.LogUtils.SystemEventLogsError(String.Format(" Error Manage Customer {0} Services: {1} . Exception: {2}", CompanyName, ServiceName, ex.Message));
         }
         this.Close();
     }
 }
 private void btnupdate_Click(object sender, EventArgs e)
 {
     using (var objServiceToCompany = new ServiceManager.ServiceSystemCompaniesClient())
     {
         try
         {
             var serviceCompany = new ServiceManager.ServiceToCompany();
             serviceCompany.Method    = "CheckToAdd";
             serviceCompany.idCompany = Convert.ToInt16(CompanyId);
             serviceCompany.idService = Convert.ToInt16(ServiceId);
             serviceCompany           = objServiceToCompany.ManageServiceToCompany(serviceCompany);
             if (!serviceCompany.isBool)
             {
                 serviceCompany.Method    = "Update";
                 serviceCompany.Startdate = Startdate;
                 serviceCompany.Enddate   = Enddate;
                 serviceCompany.Paid      = Paid;
                 serviceCompany.Price     = Price;
                 serviceCompany.priceCost = PriceCost;
                 objServiceToCompany.ManageServiceToCompany(serviceCompany);
                 MessageUtils.LogUtils.WriteToLog(" Update Manage Service To Customers");
                 MessageUtils.LogUtils.SystemEventLogsInformation(" Update Manage Service To Customers");
                 new MessageUtils.MessageBoxText("עודכן בהצלחה").OkMessaageBox();
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 MessageUtils.LogUtils.WriteToLog(" Service to Customers does not exist update failed");
                 MessageUtils.LogUtils.SystemEventLogsWarning(" Service to Customers does not exist update failed");
                 new MessageUtils.MessageBoxText("Service to Customers does not exist update failed").WarningMessageBox();
                 this.DialogResult = DialogResult.OK;
             }
         }
         catch (FaultException ex)
         {
             MessageUtils.LogUtils.WriteToLog(string.Format(" Error Update Service to Customers. Exception: {0}", ex.Message));
             MessageUtils.LogUtils.SystemEventLogsError(string.Format(" Error Update Service to Customers. Exception: {0}", ex.Message));
             new MessageUtils.MessageBoxText("Error Update Service to Customers").ErrorMessageBox();
         }
         this.Close();
     }
 }
 public DataTable InitializeListServiceCompany()
 {
     using (var ds = new DataSet())
     {
         using (var objServiceToCompany = new ServiceManager.ServiceSystemCompaniesClient())
         {
             var serviceToCompany = new ServiceManager.ServiceToCompany();
             //  serviceToCompany.Method = "GetAll";
             serviceToCompany.Method = "GetAllDataSet";
             serviceToCompany        = objServiceToCompany.ManageServiceToCompany(serviceToCompany);
             // StringReader reader = new StringReader(serviceToCompany.DataServiceToCompany);
             // ds.ReadXml(reader);
             return(serviceToCompany.ServiceToCompanyDataSet.Tables[0]);
         }
         // return ds.Tables["ServiceToCompany"];
     }
 }