Esempio n. 1
0
        public ActionResult Add()
        {
            var             count1     = medb.ps_systemconfig.Count();
            string          configCode = Request.Params["configCode"];
            string          configname = Request.Params["configname"];
            int             valueid    = int.Parse(Request.Params["valueid"]);
            string          valuename  = Request.Params["valuename"];
            int             radio      = int.Parse(Request.Params["radio"]);
            ps_systemconfig ps         = new ps_systemconfig()
            {
                configCode      = configCode,
                configName      = configname,
                configValueId   = valueid,
                configValueName = valuename,
                isStart         = radio,
            };

            medb.ps_systemconfig.InsertOnSubmit(ps);
            medb.SubmitChanges();
            var  count2 = medb.ps_systemconfig.Count();
            bool b      = false;

            if (count1 < count2)
            {
                b = true;
            }
            return(Json(b));
        }
Esempio n. 2
0
        public ActionResult addBugType()
        {
            #region 找出最大的configValueName
            int radio = int.Parse(Request.Params["radio"]);

            string BugName = Request.Params["BugName"];

            bool state = true;

            //查找出最大的configValueId
            SqlConnection con = new SqlConnection("Server=.;database=MyElectrCheck_DB;Integrated Security=true;");

            SqlCommand cmd = new SqlCommand("select max(configValueId) from ps_systemconfig", con);

            con.Open();

            int maxid = Convert.ToInt32(cmd.ExecuteScalar());

            con.Close();
            #endregion

            #region 基于最大configValueId添加一条新缺陷类型
            //创建一个新的ps_systemconfig对象添加并保存至数据库
            ps_systemconfig ps = new ps_systemconfig()
            {
                configCode = "BUG_TYPE", configName = "缺陷类别", configValueId = maxid + 1, configValueName = BugName, isStart = radio
            };

            try
            {
                medc.ps_systemconfig.InsertOnSubmit(ps);
                medc.SubmitChanges();
            }
            catch (Exception)
            {
                state = false;
            }
            #endregion
            return(Json(state));
        }
Esempio n. 3
0
        public ActionResult onOroffBugType()
        {
            #region 启用/停用类型
            int id = int.Parse(Request.Params["id"]);

            bool state = true;

            string type = "";

            ps_systemconfig result = (from a in medc.ps_systemconfig
                                      where a.id == id
                                      select a).FirstOrDefault();

            try
            {
                if (result.isStart == 1)
                {
                    type           = "停用";
                    result.isStart = 0;
                }
                else
                {
                    type           = "启用";
                    result.isStart = 1;
                }
                medc.SubmitChanges();
            }
            catch (Exception)
            {
                state = false;
            }

            use u = new use()
            {
                type = type, succ = state
            };
            #endregion
            return(Json(u));
        }