Пример #1
0
        public JsonResult InitSendType(string scode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_SendType sal = new Sys_SendType();
                if (scode != "")
                {
                    sal = smotb.Query(" and  scode='" + scode + "'");
                }
                else
                {
                    sal.id    = 0;
                    sal.scode = smotb.CreateCode().ToString().PadLeft(4, '0');
                }
                d.d = js.Serialize(sal);
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
Пример #2
0
        public JsonResult SaveSendType(string estate, string scode, string sid, string sname)
        {
            JsonData            d   = new JsonData();
            Sys_SendType        smt = new Sys_SendType();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                smt.scode  = scode;
                smt.sname  = sname;
                smt.estate = estate == "0"?false:true;
                smt.maker  = iv.u.ename;
                smt.cdate  = DateTime.Now.ToString();
                if (sid == "0")
                {
                    if (smotb.Add(smt) > 0)
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
                else
                {
                    if (smotb.Update(smt))
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }