Ejemplo n.º 1
0
        public static string SaveMaterial(string ccode, string cname, string cid, string cpcode, string cpname, string cstate, string ctype)
        {
            string              r   = "";
            Sys_MaterialBll     sub = new Sys_MaterialBll();
            Sys_Material        smc = new Sys_Material();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                smc.mccode = cpcode;
                smc.mcname = cpname;
                smc.mname  = cname;
                smc.mcode  = ccode;
                smc.mtype  = ctype;
                smc.mstate = cstate == "1" ? true : false;
                smc.maker  = iv.u.ename;
                smc.cdate  = DateTime.Now.ToString();
                if (cid == "0")
                {
                    if (sub.Add(smc) > 0)
                    {
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    if (sub.Update(smc))
                    {
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 2
0
        public static string InitMaterial(string mccode, string mcode)
        {
            string                  r    = "";
            Sys_MaterialBll         smb  = new Sys_MaterialBll();
            Sys_MaterialCategoryBll smcb = new Sys_MaterialCategoryBll();
            Sys_Material            sm   = new Sys_Material();
            Sys_MaterialCategory    smc  = new Sys_MaterialCategory();
            SessionUserValidate     iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                smc = smcb.Query(" and mccode='" + mccode + "'");
                if (mcode == "")
                {
                    if (smc != null)
                    {
                        sm.mccode = smc.mccode;
                        sm.mcname = smc.mcname;
                    }
                    else
                    {
                        sm.mccode = "";
                        sm.mcname = "";
                    }
                    sm.mcode  = mccode + smb.CreateCode(mccode).ToString().PadLeft(3, '0');
                    sm.mname  = "";
                    sm.mstate = true;
                    sm.id     = 0;
                }
                else
                {
                    sm = smb.Query(" and mcode='" + mcode + "'");
                }
                r = js.Serialize(sm);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }