Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                GenSetInfo genSetInfo = new GenSetInfo();
                genSetInfo.TillNum = txtTillNum.Text;
                //genSetInfo.CheckCurrency = txtCheckCurrency.Text;
                genSetInfo.VATPer         = txtVatPer.Text;
                genSetInfo.IsShowItemCode = chkDisplayCode.Checked ? "Y" : "N";
                genSetInfo.IsBackup       = chkIsBackup.Checked ? "Y" : "N";

                if (chkIsBackup.Checked)
                {
                    genSetInfo.BackupDriver = lueBackUpDriver.EditValue.ToString();
                }
                else
                {
                    genSetInfo.BackupDriver = "";
                }

                if (CommonData.GenSet.Any())
                {
                    genSetInfo.ID = CommonData.GenSet.FirstOrDefault().ID;
                    _control.UpdateEntity(genSetInfo);
                }
                else
                {
                    _control.AddEntity(genSetInfo);
                }

                new SystemData().GetSysValue();
                var          lstValue     = CommonData.SysValue.Where(s => s.ValueID.Equals(PubComm.SYS_VALUE_CHECK_CODE));
                SysValueInfo sysValueInfo = new SysValueInfo();

                if (lstValue.Any())
                {
                    sysValueInfo             = lstValue.FirstOrDefault();
                    sysValueInfo.ValueResult = txtTillNum.Text;
                    _control.UpdateEntity(sysValueInfo);
                }
                else
                {
                    sysValueInfo.ValueID     = PubComm.SYS_VALUE_CHECK_CODE;
                    sysValueInfo.ValueDesc   = "CHECKCODE";
                    sysValueInfo.ValueResult = txtTillNum.Text;
                    _control.AddEntity(sysValueInfo);
                }
            }
            catch (Exception ex) { LogHelper.Error(this.Name, ex); }

            CommonTool.ShowMessage("Save successful!");
        }
Пример #2
0
        public static string GetChkCode()
        {
            string chkNum = "";

            new OnLoadSystemCommonData().GetSysValueList();
            var chkCode = CommonData.SysValueList.Where(s => s.PropMod.Equals(CommonBase.SYS_VALUE_PROP_MODE_TA) && s.PropName.Equals(CommonBase.SYS_VALUE_PROP_NAME_CHECKCODE));

            if (chkCode.Any())
            {
                chkNum = (Int64.Parse(chkCode.FirstOrDefault().PropValue) + 1).ToString();

                //更新后台的值
                SysValueInfo sysValue = new SysValueInfo();
                sysValue.SystemKey = chkCode.FirstOrDefault().SystemKey;
                sysValue.PropMod   = CommonBase.SYS_VALUE_PROP_MODE_TA;
                sysValue.PropName  = CommonBase.SYS_VALUE_PROP_NAME_CHECKCODE;
                sysValue.PropValue = chkNum;
                _control.UpdateEntity(sysValue);
            }

            return(chkNum);
        }