private void InitializeListPriority()
 {
     using (var ds = new DataSet())
     {
         using (var priorityService = new ServiceManager.ServiceSystemCompaniesClient())
         {
             try
             {
                 var priority = new ServiceManager.Priority();
                 //priority.Method = "GetAllPriorities";
                 priority.Method = "GetAllPrioritiesDataSet";
                 priority        = priorityService.ManagePriority(priority);
                 //StringReader reader = new StringReader(priority.PriorityData);
                 //ds.ReadXml(reader);
                 //dgridvListPriority.DataSource = ds.Tables["Priority"];
                 dgridvListPriority.DataSource = priority.PriorityDataSet.Tables[0];
             }
             catch (FaultException ex)
             {
                 LogUtils.WriteToLog(string.Format(" Faild Viewing Priority: {0} ", ex.Message));
                 LogUtils.SystemEventLogsError(string.Format(" Faild Viewing Priority: {0} ", ex.Message));
             }
         }
     }
 }
        private void deleteRowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dgridvListPriority.SelectedRows.Count != 1)
            {
                return;
            }
            string message = "?בטוח שאתה רוצה למחוק";
            string titel   = "מחיקת עדיפות";

            if (new MessageBoxText(message, titel).YesorNoMessageBox() == DialogResult.No)
            {
                return;
            }
            DataGridViewRow dr = dgridvListPriority.SelectedRows[0];

            this.IdPriorityFromGrid = dr.Cells["idPriority"].Value.ToString();
            using (var priorityService = new ServiceManager.ServiceSystemCompaniesClient())
            {
                try
                {
                    var priority = new ServiceManager.Priority();
                    priority.Method     = "CheckPriorityId";
                    priority.IdPriority = Convert.ToInt32(this.IdPriorityFromGrid);
                    priority            = priorityService.ManagePriority(priority);
                    if (!priority.isBool)
                    {
                        priority.Method = "Delete";
                        priorityService.ManagePriority(priority);
                        LogUtils.WriteToLog(" Delete Priority ");
                        LogUtils.SystemEventLogsWarning(" Delete Priority");
                    }
                    else
                    {
                        LogUtils.WriteToLog(" Priority doesn't exist Delete faild ");
                        LogUtils.SystemEventLogsWarning(" Priority doesn't exist Delete faild");
                    }
                }
                catch (FaultException ex)
                {
                    LogUtils.WriteToLog(string.Format(" Faild Delete Priority: {0} ", ex.Message));
                    LogUtils.SystemEventLogsError(string.Format(" Faild Delete Priority: {0} ", ex.Message));
                }
            }
            InitializeListPriority();
        }
 private void btnAddPriority_Click(object sender, EventArgs e)
 {
     using (var priorityService = new ServiceManager.ServiceSystemCompaniesClient())
     {
         try
         {
             var priority = new ServiceManager.Priority();
             priority.Method       = "Insert";
             priority.TypePriority = txtbTypePriority.Text;
             priorityService.ManagePriority(priority);
             MessageUtils.LogUtils.WriteToLog(" Add Priority: " + txtbTypePriority.Text);
             MessageUtils.LogUtils.SystemEventLogsInformation(" Add Priority: " + txtbTypePriority.Text);
             new MessageUtils.MessageBoxText(string.Format(" עדיפות נוסף בהצלחה: {0}", txtbTypePriority.Text)).OkMessaageBox();
         }
         catch (FaultException ex)
         {
             MessageUtils.LogUtils.WriteToLog(string.Format(" Error Add Priority: {0} Exception: {1} ", txtbTypePriority.Text, ex.Message));
             MessageUtils.LogUtils.SystemEventLogsError(string.Format(" Error Add Priority: {0} Exception: {1} ", txtbTypePriority.Text, ex.Message));
         }
         this.Close();
     }
 }
        private void InitializeListPriority()
        {
            if (IsForSpecificServiceCalls)
            {
                combPriority1.Items.Clear();
                IDToName calls = new IDToName(this.Priority, this.IdPriority);
                combPriority1.Items.Add(calls);
                btnUpdate1.Enabled = true;
            }
            else

            {
                using (var priorityService = new ServiceManager.ServiceSystemCompaniesClient())
                {
                    try
                    {
                        var priority = new ServiceManager.Priority();
                        priority.Method = "GetAllPrioritiesToDropDown";
                        priority        = priorityService.ManagePriority(priority);
                        foreach (var listPriority in priority.list)
                        {
                            this.Priority   = listPriority.Item2;// TypePriority;
                            this.IdPriority = Convert.ToString(listPriority.Item1);
                            IDToName priorityToDrop = new IDToName(this.Priority, this.IdPriority);
                            combPriority1.Items.Add(priorityToDrop);
                        }
                    }
                    catch (FaultException ex)
                    {
                        LogUtils.WriteToLog(string.Format(" Error Get All Priorities To DropDown. Exception: {0}", ex.Message));
                        LogUtils.SystemEventLogsError(string.Format(" Error Get All Priorities To DropDown. Exception: {0}", ex.Message));
                    }
                }
                if (combPriority1.Items.Count > 0)
                {
                    combPriority1.SelectedIndex = 0;
                }
            }
        }