Exemple #1
0
        public JsonResult InitSizeFormatCate(string sfcode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_SizeFormatCate sal = new Sys_SizeFormatCate();
                if (sfcode != "")
                {
                    sal = ssfcb.Query(" and  sfcode='" + sfcode + "'");
                }
                else
                {
                    sal.sfcode = ssfcb.CreateCode().ToString().PadLeft(4, '0');
                    sal.id     = 0;
                }
                d.d = js.Serialize(sal);
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
Exemple #2
0
        public JsonResult SaveSizeFormatCate(string cfcode, string cfname, string cid, string sftype)
        {
            JsonData            d  = new JsonData();
            Sys_SizeFormatCate  sb = new Sys_SizeFormatCate();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                sb.sfname = cfname;
                sb.sfcode = cfcode;
                sb.maker  = iv.u.ename;
                sb.sftype = sftype;
                sb.cdate  = DateTime.Now.ToString();
                if (iv.u.dcode == "")
                {
                    sb.bdcode = "00010001";
                }
                else
                {
                    sb.bdcode = iv.u.dcode.Substring(0, 8);
                }
                if (cid == "0")
                {
                    if (ssfcb.Add(sb) > 0)
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
                else
                {
                    if (ssfcb.Update(sb))
                    {
                        d.d = "S";
                    }
                    else
                    {
                        d.d = "F";
                    }
                }
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }
Exemple #3
0
        public JsonResult CopySizeFormatCate(string sfcode)
        {
            JsonData            d  = new JsonData();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string             r   = "";
                Sys_SizeFormatCate sal = new Sys_SizeFormatCate();
                Sys_SizeFormatCate yal = ssfcb.Query(" and sfcode='" + sfcode + "'");
                if (yal != null)
                {
                    sal        = yal;
                    sal.sfcode = ssfcb.CreateCode().ToString().PadLeft(4, '0');
                    if (ssfcb.Add(sal) > 0)
                    {
                        List <Sys_SizeFomatCondition> lc = sscb.QueryList(" and sfcode='" + sfcode + "'");
                        if (lc != null)
                        {
                            foreach (Sys_SizeFomatCondition sc in lc)
                            {
                                string sfccode = sc.sfccode;
                                sc.sfcode  = sal.sfcode;
                                sc.sfname  = sal.sfname;
                                sc.sfccode = sscb.CreateCode().ToString().PadLeft(4, '0');
                                if (sscb.Add(sc) > 0)
                                {
                                    List <Sys_SizeFormatCollection> lf = ssfb.QueryList(" and sfccode ='" + sfccode + "'");
                                    if (lf != null)
                                    {
                                        foreach (Sys_SizeFormatCollection sl in lf)
                                        {
                                            sl.sfcode  = sc.sfcode;
                                            sl.sfname  = sc.sfname;
                                            sl.sfccode = sc.sfccode;
                                            sl.sfcname = sc.sfcname;
                                            if (ssfb.Add(sl) > 0)
                                            {
                                                r = "S";
                                            }
                                            else
                                            {
                                                r = "F";
                                                break;
                                            }
                                        }
                                        if (r == "F")
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (r == "F")
                    {
                        ssfcb.Delete(sal.sfcode);
                    }
                }
                d.d = r;
            }
            else
            {
                d.d = iv.badstr;
            }
            return(Json(d));
        }