Example #1
0
        public JsonResult InitMzType(string mtcode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_MzOrderType sal = new Sys_MzOrderType();
                if (mtcode != "")
                {
                    sal = smotb.Query(" and  mtcode='" + mtcode + "'");
                }
                else
                {
                    sal.id     = 0;
                    sal.mtcode = smotb.CreateCode().ToString().PadLeft(4, '0');
                }
                d.d = js.Serialize(sal);
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
Example #2
0
        public JsonResult SaveMzType(string emcode, string id, string mtcode, string mtname, string otype)
        {
            JsonData            d   = new JsonData();
            Sys_MzOrderType     smt = new Sys_MzOrderType();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                smt.mtcode = mtcode;
                smt.mtname = mtname;
                smt.emcode = emcode;
                smt.maker  = iv.u.ename;
                smt.otype  = otype;
                smt.cdate  = DateTime.Now.ToString();
                if (id == "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));
        }
Example #3
0
        public static string QueryOrderType(string sid, string attr)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_MzSaleOrder bms = bmsob.Query("and sid='" + sid + "'");
                if (bms != null)
                {
                    Sys_MzOrderType smot = smotb.Query(" and mtname='" + bms.dtype + "' and otype='" + attr + "'");
                    r = smot != null ? smot.emcode : "";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Example #4
0
        public static string SaveMzOrder(string address, string area, string city, string citycode, string colorpane, string customer,
                                         string dcode, string designer, string dname, string dtype, string id, string lxtype, string maker, string mname, string otype, string precode, string remark, string sid, string source, string telephone)
        {
            string              r   = "";
            B_QbqqSaleOrder     bms = new B_QbqqSaleOrder();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                bms.acode     = "";
                bms.aname     = "";
                bms.address   = address;
                bms.community = area;
                bms.city      = city;
                bms.citycode  = citycode;
                bms.colorpane = colorpane;
                bms.customer  = customer;
                bms.dname     = dname;
                bms.dcode     = dcode;
                bms.designer  = designer;
                bms.maker     = iv.u.ename;
                bms.mname     = mname;
                bms.otype     = otype;
                bms.ycode     = precode;
                bms.remark    = remark;
                bms.source    = source;
                bms.telephone = telephone;
                bms.packtype  = lxtype;
                bms.dtype     = dtype;
                bms.cdate     = DateTime.Now.ToString();
                if (id == "0")
                {
                    bms.sid = CommonBll.GetSid();
                    CB_OrderState cos = new CB_OrderState();
                    if (bmsob.Add(bms) > 0)
                    {
                        Sys_MzOrderType smot = smotb.Query(" and mtname='" + dtype + "'");
                        if (smot != null)
                        {
                            bwfb.CreateWorkFlow(bms.sid, smot.emcode);
                        }
                        cos.sid = bms.sid;
                        cosb.Add(cos);
                        if (!bcb.Exists(" and telephone='" + telephone + "'"))
                        {
                            B_Customer bc = new B_Customer();
                            bc.dname     = bms.dname;
                            bc.dcode     = bms.dcode;
                            bc.customer  = bms.customer;
                            bc.telephone = bms.telephone;
                            bc.community = bms.community;
                            bc.address   = bms.address;
                            bc.cdate     = DateTime.Now.ToString();
                            bc.maker     = bms.maker;
                            bcb.Add(bc);
                        }
                        r = bms.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    bms.sid = sid;
                    if (bmsob.Update(bms))
                    {
                        Sys_MzOrderType smot = smotb.Query(" and mtname='" + dtype + "'");
                        if (smot != null)
                        {
                            bwfb.CreateWorkFlow(bms.sid, smot.emcode);
                        }
                        r = bms.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }