Esempio n. 1
0
        public static string Confirm(string sid, string transCompanyId, string transTypeId, string validationCode, string contact)
        {
            int result = ConsumerDAO.CheckAvaliableSID(sid);

            if (result >= 1)
            {
                int madv = 0;
                if (int.TryParse(transCompanyId, out madv))
                {
                    int madh = 0;
                    int.TryParse(validationCode, out madh);
                    int soluong = GeneralPurchasingDAO.GetNumberCouponInOrder(madh);
                    if (soluong == 0)
                    {
                        return("Đơn hàng chưa được duyệt");
                    }
                    int transtype = 0;
                    int.TryParse(transTypeId, out transtype);
                    SERVICE_TRANS_DTO sv = GeneralPurchasingDAO.GetInfoServiceTrans(madv);

                    /*string bizAddress = "";
                     * if (ConfigurationManager.AppSettings.GetValues(transCompanyId)[0] != null)
                     * {
                     *  bizAddress = ConfigurationManager.AppSettings.GetValues(transCompanyId)[0];
                     * }
                     * else
                     * {
                     *  bizAddress = ConfigurationManager.AppSettings.GetValues("biz")[0];
                     * }*/
                    VanChuyen.FedexWebService1 proxy = new BizWebservice.VanChuyen.FedexWebService1();
                    proxy.Url = sv.LinkWebService;
                    string id = proxy.Authenticate(sv.UserName, sv.PassWord);
                    // proxy.Url = "http://thuongmainhommot.somee.com/Service/WebServiceVanChuyen.asmx";
                    // string id = proxy.Authenticate("demo","123");
                    string url = proxy.TransportGoods(id, validationCode, soluong, DateTime.Today.Date.AddDays(1), contact, transtype, sv.BizAddress);
                    // if (url.IndexOf("http://") >= 0 || url.IndexOf("https://") >= 0)
                    if (url.IndexOf(".aspx?") >= 0)
                    {
                        // string package = proxy.GetPackageInfo(id, url);
                        int result1 = GeneralPurchasingDAO.ConfirmOrder(madh, contact, sid);

                        /*  if (result1 != 1)
                         * {
                         *    proxy.CancelPackage(id, url);
                         * }*/
                    }
                    return(url);
                }
                else
                {
                    return("false");
                }
            }
            else
            {
                return("Invalid sid");
            }
        }
Esempio n. 2
0
 public static int CapNhatTaiKhoanKhachHang(KHACH_HANG_DTO kh)
 {
     try
     {
         return(ConsumerDAO.CapNhatTaiKhoanKhachHang(kh));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 3
0
 public static KHACH_HANG_DTO XemThongTinTaiKhoan(string username)
 {
     try
     {
         return(ConsumerDAO.XemThongTinTaiKhoan(username));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 4
0
 public static Coupon FindCouponInfo(string sid, string couponId)
 {
     try
     {
         int result = ConsumerDAO.CheckAvaliableSID(sid);
         if (result == 1)
         {
             return(GeneralPurchasingDAO.FindCouponInfo(couponId));
         }
         else
         {
             return(new Coupon());
         }
     }
     catch (Exception e)
     {
         return(new Coupon());
     }
 }
Esempio n. 5
0
 public static Coupon[] FindAllCoupons(string sid)
 {
     try
     {
         int result = ConsumerDAO.CheckAvaliableSID(sid);
         if (result == 1)
         {
             return(GeneralPurchasingDAO.FindAllCoupons());
         }
         else
         {
             return(new Coupon[0]);
         }
     }
     catch (Exception e)
     {
         return(new Coupon[0]);
     }
 }
Esempio n. 6
0
 public static bool RegisterCoupon(string sid, string couponId)
 {
     try
     {
         int result = ConsumerDAO.CheckAvaliableSID(sid);
         if (result == 1)
         {
             return(GeneralPurchasingDAO.RegisterCoupon(couponId));
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Esempio n. 7
0
 public static Coupon[] FindCoupons(string sid, string productName,
                                    DateTime startDate, DateTime endDate,
                                    int minPrice, int maxPrice)
 {
     try
     {
         int result = ConsumerDAO.CheckAvaliableSID(sid);
         if (result == 1)
         {
             return(GeneralPurchasingDAO.FindCoupons(productName, startDate, endDate, minPrice, maxPrice));
         }
         else
         {
             return(new Coupon[0]);
         }
     }
     catch (Exception e)
     {
         return(new Coupon[0]);
     }
 }