예제 #1
0
        public JsonResult InitPeriod(string fcode, string gqcode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_ProductionPeriod sal = new Sys_ProductionPeriod();
                if (gqcode != "")
                {
                    sal = sltb.Query(" and  gqcode='" + gqcode + "'");
                }
                else
                {
                    sal.fcode  = fcode;
                    sal.gqcode = sltb.CreateCode().ToString().PadLeft(4, '0');
                    sal.id     = 0;
                }
                d.d = js.Serialize(sal);
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
예제 #2
0
        public JsonResult SavePeriod(string fcode, string gqcode, string gqid, string gqname, string gqnum)
        {
            JsonData             d  = new JsonData();
            Sys_ProductionPeriod sb = new Sys_ProductionPeriod();
            SessionUserValidate  iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_Depment sd = sdb.Query("and dcode='" + fcode + "'");
                if (sd != null)
                {
                    sb.fcode = sd.dcode;
                    sb.fname = sd.dname;
                }
                sb.gqname = gqname;
                sb.gqcode = gqcode;
                sb.gqnum  = Convert.ToInt32(gqnum);
                sb.maker  = iv.u.ename;
                sb.cdate  = DateTime.Now.ToString();
                if (gqid == "0")
                {
                    if (sltb.Add(sb) > 0)
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
                else
                {
                    if (sltb.Update(sb))
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }