Ejemplo n.º 1
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     try
     {
         int      oID         = Int32.Parse(tbOrderID.Text);
         string   cID         = tbCustomerID.Text;
         int      eID         = Int32.Parse(tbEmployeeID.Text);
         DateTime oDate       = dtOrder.Value;
         DateTime rDate       = dtRequired.Value;
         DateTime sDate       = dtShipped.Value;
         int      sVia        = Int32.Parse(tbShipVia.Text);
         float    fre         = float.Parse(tbFreight.Text);
         string   sName       = tbShipName.Text;
         string   sAddress    = tbShipAddress.Text;
         string   sCity       = tbShipCity.Text;
         string   sRegion     = tbShipRegion.Text;
         string   sPostalCode = tbShipPostalCode.Text;
         string   sCountry    = tbShipCountry.Text;
         Orders   order       = new Orders(oID, cID, eID, oDate, rDate, sDate, sVia, fre, sName, sAddress, sCity, sRegion, sPostalCode, sCountry);
         B_Orders.UpdateOrder(order);
         MessageBox.Show("Bạn đã sửa order có ID " + oID + " thành công!");
         dtgvOrders.DataSource = B_Orders.getAllOrders();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
        public static string SaveOrder(string sid, string ncity, string nprovince, string nad)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string      dc = iv.u.dcode;
                Sys_Depment sd = sdb.Query(" and dcode='" + dc + "'");
                B_Customer  bc = bcb.Query(" and sid='" + sid + "'");
                if (bc != null)
                {
                    B_Orders bs = new B_Orders();
                    bs.address   = nad.Trim() == "" ? bs.address : nad;
                    bs.community = "";
                    bs.cdate     = DateTime.Now.ToString();
                    bs.city      = bc.city;
                    bs.citycode  = bc.citycode;
                    bs.csid      = bc.sid;
                    bs.customer  = bc.customer;
                    bs.dcode     = bc.dcode;
                    bs.dname     = bc.dname;
                    bs.telephone = bc.telephone;
                    bs.sid       = CommonBll.GetSid();
                    bs.acity     = ncity;
                    bs.aprovince = nprovince;
                    bs.zcode     = "Z" + DateTime.Now.ToString("yyyyMMddHHmmss");
                    if (bob.Add(bs) > 0)
                    {
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 3
0
        public static string InitOrder(string sid, string zsid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_SaleOrder bco = new B_SaleOrder();
                if (sid != "")
                {
                    bco = bsob.Query(" and sid='" + sid + "'");
                    r   = js.Serialize(bco);
                }
                else
                {
                    if (zsid != "")
                    {
                        B_Orders       bo  = bob.Query(" and sid='" + zsid + "'");
                        Sys_DepmentDpt sdd = sddb.Query(" and dcode='" + bo.dcode + "'");
                        bco.city       = bo.city;
                        bco.citycode   = bo.citycode;
                        bco.dname      = bo.dname;
                        bco.dcode      = bo.dcode;
                        bco.zsid       = bo.sid;
                        bco.customer   = bo.customer;
                        bco.telephone  = bo.telephone;
                        bco.address    = bo.address;
                        bco.community  = bo.community;
                        bco.zcode      = bo.zcode;
                        bco.stelephone = sdd != null ? sdd.dcontact : "";
                        bco.maker      = iv.u.ename;
                    }
                    r = js.Serialize(bco);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 4
0
        public static string InitQuery(string sid)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_Orders   bo = new B_Orders();
                B_Customer bc = bcb.Query(" and sid='" + sid + "'");
                if (bc != null)
                {
                    bo.acity     = bc.acity;
                    bo.aprovince = bc.aprovince;
                    bo.address   = bc.address;
                }
                r = js.Serialize(bo);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 5
0
        public static string SaveCustomer(string acity, string address, string aprovince, string ctype, string customer, string telephone)
        {
            string r = "";
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                if (bcb.Exists(" and telephone='" + telephone + "' and address='" + address.Trim() + "'"))
                {
                    r = "T";
                }
                else
                {
                    string      dc = iv.u.dcode;
                    Sys_Depment sd = sdb.Query(" and dcode='" + dc + "'");
                    B_Customer  bc = new B_Customer();
                    bc.sid       = CommonBll.GetSid();
                    bc.address   = address;
                    bc.community = "";
                    bc.ctype     = ctype;
                    bc.customer  = customer;
                    bc.telephone = telephone.Trim();
                    bc.acity     = acity;
                    bc.aprovince = aprovince;
                    if (sd.dattr == "dm")
                    {
                        bc.dcode    = sd.dcode;
                        bc.dname    = sd.dname;
                        bc.city     = sd.dpname;
                        bc.citycode = sd.dpcode;
                        bc.bdcode   = sd.dcode.Substring(0, 8);
                    }
                    else
                    {
                        Sys_Depment sdc = sdb.Query(" and dpcode='" + sd.dcode + "'");
                        if (sdc != null)
                        {
                            bc.dcode = sdc.dcode;
                            bc.dname = sdc.dname;
                        }
                        bc.city     = sd.dname;
                        bc.citycode = sd.dcode;
                        bc.bdcode   = sd.dcode.Substring(0, 8);
                    }
                    bc.maker = iv.u.ename;
                    bc.cdate = DateTime.Now.ToString();
                    if (bcb.Add(bc) > 0)
                    {
                        B_Orders bs = new B_Orders();
                        bs.address   = address;
                        bs.cdate     = DateTime.Now.ToString();
                        bs.city      = bc.city;
                        bs.citycode  = bc.citycode;
                        bs.community = bc.community;
                        bs.csid      = bc.sid;
                        bs.customer  = customer;
                        bs.dcode     = bc.dcode;
                        bs.dname     = bc.dname;
                        bs.telephone = bc.telephone;
                        bs.sid       = CommonBll.GetSid();
                        bs.zcode     = "Z" + DateTime.Now.ToString("yyyyMMddHHmmss");
                        bob.Add(bs);
                        r = bs.csid;
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 6
0
        public static string SaveOrder(string acity, string address, string aprovince, string azperson, string bcode, string city, string citycode, string clperson, string ctype, string customer, string dcode, string discode, string dname, string emcode, string iscl, string maker, string mname, string otype, string pbdcode, string qytype, string remark, string saletelephone, string sdtype, string sid, string source, string stype, string telephone, string untype, string zcode, string zsid)
        {
            string r     = "";
            string saddr = "";

            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                B_Orders           bo   = bob.Query(" and sid='" + zsid + "'");
                Sys_CityGetAddress scga = scgab.QueryFrist(" and dcode='" + citycode + "'");
                Sys_Brands         sbs  = sbb.Query(" and pbcode='" + pbdcode + "'");
                B_SaleOrder        bco  = new B_SaleOrder();
                if (scga != null)
                {
                    saddr = scga.address;
                }
                bco.csid        = bo != null ? bo.csid : "";
                bco.zsid        = zsid;
                bco.zcode       = bo != null?bo.zcode:"";
                bco.wcode       = "";
                bco.oscode      = "";
                bco.customer    = customer;
                bco.telephone   = telephone;
                bco.community   = "";
                bco.address     = address.Replace(",", ",");
                bco.dname       = dname;
                bco.dcode       = dcode;
                bco.city        = city;
                bco.citycode    = citycode;
                bco.gzname      = "";
                bco.gztelephone = "";
                bco.stelephone  = saletelephone;
                bco.otype       = otype;
                bco.sendtype    = stype;
                bco.sdtype      = sdtype;
                bco.mname       = mname;
                bco.source      = source;
                bco.remark      = remark.Replace(",", ",");
                bco.maker       = maker;
                bco.cdate       = DateTime.Now.ToString();
                bco.istax       = false;
                bco.isdf        = false;
                bco.iscl        = iscl == "0" ? false : true;
                bco.colorpane   = "";
                bco.floor       = "";
                bco.disactcode  = discode;
                bco.bdcode      = iv.u.dcode.Substring(0, 8);
                bco.clperson    = clperson;
                bco.azperson    = azperson;
                bco.pbdcode     = pbdcode;
                bco.pbdname     = sbs != null ? sbs.pbname : "";
                bco.saddress    = aprovince == "" ? saddr : aprovince + acity + address;
                bco.qytype      = qytype;
                bco.ctype       = ctype;
                bco.untype      = untype;
                if (bco.citycode.Substring(0, 12) != "000100010008")
                {
                    bco.package = "外地包装";
                }
                else
                {
                    bco.package = "本地包装";
                }
                bco.sdcode = "S" + DateTime.Now.ToString("yyMM") + bsob.QueryOrderNum();
                if (sid == "")
                {
                    CB_OrderState cos = new CB_OrderState();
                    bco.sid   = CommonBll.GetSid();
                    bco.qtimg = qcb.CreateQtCode(System.Web.HttpContext.Current.Server.MapPath("/UpFile/OrderQt/"), CommonBll.GetHost() + "/UIClient/QtScan/OrderDetail.htm?Sid=" + bco.sid);
                    if (bsob.Add(bco) > 0)
                    {
                        bwfb.CreateWorkFlow(bco.sid, emcode);
                        cos.sid = bco.sid;
                        cosb.Add(cos);
                        r = bco.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                    EventBtnDo.FireEventBtn(bco.sid, bcode, "1", " 保存订单");
                }
                else
                {
                    bco.sid = sid;
                    if (bsob.Update(bco))
                    {
                        if (bmob.Exists(" and osid='" + sid + "'"))
                        {
                            if (!bco.iscl)
                            {
                                bmob.Delete(" and osid='" + sid + "'");
                            }
                        }
                        r = bco.sid;
                    }
                    else
                    {
                        r = "F";
                    }
                    EventBtnDo.FireEventBtn(bco.sid, bcode, "1", " 更改订单");
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Ejemplo n.º 7
0
 //private void loading()
 //{
 //    cur= dtgvOrders.
 //}
 private void Form1_Load(object sender, EventArgs e)
 {
     dtgvOrders.DataSource = B_Orders.getAllOrders();
 }