Exemple #1
0
        public static int AcceptOrdersCoupon(string macp, int typePrice, ref string error)
        {
            try
            {
                float  price = 0;
                string unit  = "";
                List <AcceptCouponDTO> list = CouponDAO.AcceptOrdersCoupon(macp, typePrice, ref price, ref unit);
                // MuaChung.Service1 proxy = new BIZ.MuaChung.Service1();
                MuaChung.MuaChungWebService proxy = new BIZ.MuaChung.MuaChungWebService();

                /* chỗ này sẽ duyệt lần lượt webservice kết nối và báo cho mua chung biết */
                foreach (AcceptCouponDTO ac in list)
                {
                    proxy.Url = ac.LinkWS;
                    string sid = null;
                    try
                    {
                        sid = proxy.Authenticate(ac.McUserName, ac.McPassWord);
                    }
                    catch (Exception ex)
                    {
                        error += ac.TenDN + "; ";
                        continue;
                    }
                    if (sid == null)
                    {
                        error += ac.TenDN + "; ";
                    }
                    bool test = false;
                    try
                    {
                        test = proxy.ConfirmCoupon(sid, macp, price, unit);
                    }
                    catch (Exception ex)
                    {
                        error += ac.TenDN + "; ";
                        continue;
                    }
                    if (test == false)
                    {
                        error += ac.TenDN + "; ";
                    }
                }
                return(1);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #2
0
        public static int AcceptOrdersCoupon(string macp, int typePrice,ref string error)
        {
            try
            {
                float price = 0;
                string unit = "";
                List<AcceptCouponDTO> list = CouponDAO.AcceptOrdersCoupon(macp, typePrice,ref price,ref unit);
               // MuaChung.Service1 proxy = new BIZ.MuaChung.Service1();
                MuaChung.MuaChungWebService proxy = new BIZ.MuaChung.MuaChungWebService();

                /* chỗ này sẽ duyệt lần lượt webservice kết nối và báo cho mua chung biết */
                foreach (AcceptCouponDTO ac in list)
                {
                    proxy.Url = ac.LinkWS;
                    string sid=null;
                    try
                    {

                        sid = proxy.Authenticate(ac.McUserName, ac.McPassWord);
                    }
                    catch (Exception ex)
                    {
                        error += ac.TenDN + "; ";
                        continue;
                    }
                    if(sid ==null)
                        error += ac.TenDN + "; ";
                    bool test = false;
                    try
                    {
                        test = proxy.ConfirmCoupon(sid, macp, price, unit);
                    }
                    catch (Exception ex)
                    {
                        error += ac.TenDN + "; ";
                        continue;
                    }
                    if (test == false)
                    {
                        error += ac.TenDN + "; ";
                    }
                }
                return 1;
            }
            catch (Exception e)
            {
                throw e;
            }
        }