示例#1
0
        /// <summary>
        /// 保存
        /// </summary>
        private bool Save()
        {
            bool flag = false;

            try
            {
                List <SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll();
                if (validators.Count > 0)
                {
                    return(false);
                }

                CheckSubmitForm(out flag);

                if (!flag)
                {
                    return(false);
                }
                if (rbWomen.IsChecked == true)
                {
                    entLeaveTypeSet.SEXRESTRICT = "0";
                }
                if (rbMan.IsChecked == true)
                {
                    entLeaveTypeSet.SEXRESTRICT = "1";
                }
                if (rbNoLimit.IsChecked == true)
                {
                    entLeaveTypeSet.SEXRESTRICT = "2";
                }
                if (FormType == FormTypes.New)
                {
                    //如果最小值是0.5获取到的值是0
                    if (nudMaxDays.Value > 0)
                    {
                        if (entLeaveTypeSet.MAXDAYS == 0)
                        {
                            entLeaveTypeSet.MAXDAYS = decimal.Round((decimal)nudMaxDays.Value, 2); //(decimal)nudMaxDays.Value;
                        }
                    }
                    clientAtt.AddLeaveTypeSetAsync(entLeaveTypeSet);
                }
                else
                {
                    entLeaveTypeSet.MAXDAYS = decimal.Round((decimal)entLeaveTypeSet.MAXDAYS, 2);
                    clientAtt.ModifyLeaveTypeSetAsync(entLeaveTypeSet);
                }

                loadbar.Start();
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message));
            }

            return(flag);
        }