Пример #1
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.NameEdit.Text.Trim()))
            {
                return;
            }

            string strStartTime = this.StartTimeContorl.GetMyValue();
            string strEndTime   = this.EndTimeContorl.GetMyValue();


            if (bIsEdit)
            {
                m_Shift.Name      = this.NameEdit.Text;
                m_Shift.StartTime = strStartTime;
                m_Shift.EndTime   = strEndTime;

                CommClient.Shift shiftClient = new CommClient.Shift();
                if (shiftClient.UpdateShift(m_Shift))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
            else
            {
                CommContracts.Shift shift = new CommContracts.Shift();
                shift.Name      = this.NameEdit.Text;
                shift.StartTime = strStartTime;
                shift.EndTime   = strEndTime;

                CommClient.Shift shiftClient = new CommClient.Shift();
                if (shiftClient.SaveShift(shift))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
        }