Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                tbCommCode af = amsContext.tbCommCode.FirstOrDefault(c => c.vcCommSign == "AF" && c.vcCommName == "Awoke");
                if (af != null)
                {
                    if (chkAF.Checked)
                    {
                        af.vcCommCode = "1";
                    }
                    else
                    {
                        af.vcCommCode = "0";
                    }
                }
                else
                {
                    af            = new tbCommCode();
                    af.vcComments = "是否启用自动提醒";
                    af.vcCommName = "Awoke";
                    af.vcCommSign = "AF";
                    if (chkAF.Checked)
                    {
                        af.vcCommCode = "1";
                    }
                    else
                    {
                        af.vcCommCode = "0";
                    }
                    amsContext.AddTotbCommCode(af);
                }

                tbCommCode agf = amsContext.tbCommCode.FirstOrDefault(c => c.vcCommSign == "AGF" && c.vcCommName == "AgianFee");
                if (agf != null)
                {
                    agf.vcCommCode = txtAgf.Value.ToString();
                }
                else
                {
                    agf            = new tbCommCode();
                    agf.vcComments = "补发卡工本费金额";
                    agf.vcCommName = "AgianFee";
                    agf.vcCommSign = "AGF";
                    agf.vcCommCode = txtAgf.Value.ToString();
                    amsContext.AddTotbCommCode(agf);
                }
                tbCommCode ak = amsContext.tbCommCode.FirstOrDefault(c => c.vcCommSign == "AK" && c.vcCommName == "Awoke");
                if (ak != null)
                {
                    ak.vcCommCode = txtAK.Value.ToString();
                }
                else
                {
                    ak            = new tbCommCode();
                    ak.vcComments = "自动提醒积分分值";
                    ak.vcCommName = "Awoke";
                    ak.vcCommSign = "AK";
                    ak.vcCommCode = txtAK.Value.ToString();
                    amsContext.AddTotbCommCode(ak);
                }
                Helper.Save(amsContext);
                MessageBox.Show(this, "修改成功", "提示");
            }
            catch (Exception ex)
            {
                ErrorLog.Write(this, ex);
            }
        }