Example #1
0
 public bool CheckUpdateQuantityParameters(SortedDictionary <string, string> parameters, out int num_iid, out int quantity, out int type, out string result)
 {
     num_iid  = 0;
     quantity = 0;
     type     = 1;
     if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
     {
         return(false);
     }
     if (!int.TryParse(parameters["num_iid"], out num_iid))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "num_iid");
         return(false);
     }
     if (!int.TryParse(parameters["quantity"], out quantity))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "quantity");
         return(false);
     }
     if (!int.TryParse(parameters["type"], out type))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "type");
         return(false);
     }
     return(true);
 }
Example #2
0
 public static bool CheckSystemParameters(System.Collections.Generic.SortedDictionary <string, string> parameters, string app_key, out string result)
 {
     result = string.Empty;
     if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["app_key"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_App_Key, "app_key");
         return(false);
     }
     if (app_key != parameters["app_key"])
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_App_Key, "app_key");
         return(false);
     }
     if (!parameters.Keys.Contains("timestamp") || string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["timestamp"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Timestamp, "timestamp");
         return(false);
     }
     if (!OpenApiHelper.IsDate(parameters["timestamp"]) || !OpenApiSign.CheckTimeStamp(parameters["timestamp"]))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "timestamp");
         return(false);
     }
     if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["sign"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Signature, "sign");
         return(false);
     }
     return(true);
 }
Example #3
0
        public static bool CheckSystemParameters(string in_app_key, string in_timestamp, string in_sign, out string result)
        {
            result = string.Empty;
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (string.IsNullOrEmpty(DataHelper.CleanSearchString(in_app_key)))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Missing_App_Key, "app_key");
                return(false);
            }
            if (!siteSettings.AppKey.Equals(in_app_key))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_App_Key, "app_key");
                return(false);
            }
            if (string.IsNullOrEmpty(DataHelper.CleanSearchString(in_timestamp)))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Missing_Timestamp, "timestamp");
                return(false);
            }
            if (!OpenApiHelper.IsDate(in_timestamp) || !OpenApiSign.CheckTimeStamp(in_timestamp))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Timestamp, "timestamp");
                return(false);
            }
            if (string.IsNullOrEmpty(DataHelper.CleanSearchString(in_sign)))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Missing_Signature, "sign");
                return(false);
            }
            return(true);
        }
Example #4
0
        public string ChangLogistics(string tid, string company_name, string out_sid)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(tid);

            if (orderInfo == null || string.IsNullOrEmpty(orderInfo.OrderId))
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_not_Exists, "tid"));
            }
            if (orderInfo.OrderStatus == OrderStatus.Refunded || orderInfo.OrderStatus == OrderStatus.Returned || orderInfo.OrderStatus == OrderStatus.Closed || (orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (!(orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) && orderInfo.OrderStatus != OrderStatus.SellerAlreadySent))
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_Print, "orderstatue"));
            }
            ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(company_name);

            orderInfo.ExpressCompanyAbb  = expressCompanyInfo.Kuaidi100Code;
            orderInfo.ExpressCompanyName = expressCompanyInfo.Name;
            orderInfo.IsPrinted          = true;
            orderInfo.ShipOrderNumber    = out_sid;
            if (!OrderHelper.UpdateOrder(orderInfo))
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Print_Faild, "order"));
            }
            string format = "{{\"logistics_change_response\":{{\"shipping\":{{\"is_success\":{0}}}}}}}";

            return(string.Format(format, "true"));
        }
Example #5
0
 private bool CheckChangLogisticsParameters(SortedDictionary <string, string> parameters, ref string result)
 {
     if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
     {
         return(false);
     }
     if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["tid"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "tid");
         return(false);
     }
     if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["company_name"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "company_name");
         return(false);
     }
     if (!ExpressHelper.IsExitExpress(DataHelper.CleanSearchString(parameters["company_name"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Company_not_Exists, "company_name");
         return(false);
     }
     if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["out_sid"])))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "out_sid");
         return(false);
     }
     if (DataHelper.CleanSearchString(parameters["out_sid"]).Length > 20)
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Out_Sid_Too_Long, "out_sid");
         return(false);
     }
     return(true);
 }
        private string _updateProductApproveStatus(ProductApproveStatusParam data)
        {
            string result = "";

            if (this.CheckUpdateApproveStatusParameters(data, out result))
            {
                SiteSettings siteSettings = HiContext.Current.SiteSettings;
                string       text         = OpenApiSign.Sign(data.SignStr(siteSettings.CheckCode), "MD5", "utf-8");
                result = ((!text.Equals(data.sign)) ? OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Signature, "sign") : this.lastUpdateProductApproveStatus(data.num_iid, data.approve_status));
            }
            return(result);
        }
 private bool CheckUpdateQuantityParameters(ProductQuantityParam parameter, out string result)
 {
     if (!OpenApiHelper.CheckSystemParameters(parameter.app_key, parameter.timestamp, parameter.sign, out result))
     {
         return(false);
     }
     if (parameter.num_iid <= 0)
     {
         result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "num_iid");
         return(false);
     }
     return(true);
 }
Example #8
0
 private bool CheckTradesParameters(SortedDictionary <string, string> parameters, ref string results)
 {
     if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out results))
     {
         return(false);
     }
     if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["tid"])))
     {
         results = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "tid");
         return(false);
     }
     return(true);
 }
Example #9
0
        public string GetTrade(string tid)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(tid);

            if (orderInfo == null || string.IsNullOrEmpty(orderInfo.OrderId))
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_not_Exists, "tid"));
            }
            string format = "{{\"trade_get_response\":{{\"trade\":{0}}}}}";
            string arg    = this.ConvertTrades(orderInfo);

            return(string.Format(format, arg));
        }
Example #10
0
 public bool CheckProductParameters(SortedDictionary <string, string> parameters, out int num_iid, out string result)
 {
     num_iid = 0;
     if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
     {
         return(false);
     }
     if (!int.TryParse(parameters["num_iid"], out num_iid))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "num_iid");
         return(false);
     }
     return(true);
 }
Example #11
0
        public string GetProduct(int num_iid)
        {
            product_item_model productForApi = ProductHelper.GetProductForApi(num_iid);

            if (productForApi == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            productForApi.props_name = ProductHelper.GetPropsForApi(num_iid);
            productForApi.skus       = ProductHelper.GetSkusForApi(num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(productForApi)));
        }
        private bool CheckUserParameters(SortedDictionary <string, string> parameters, out string result)
        {
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (!OpenApiHelper.CheckSystemParameters(parameters, siteSettings.AppKey, out result))
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["user_name"])))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "user_name");
                return(false);
            }
            return(true);
        }
        private string GetProduct(int num_iid)
        {
            ProductApiDao      productApiDao = new ProductApiDao();
            product_item_model product       = productApiDao.GetProduct(num_iid);

            if (product == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            product.props_name = productApiDao.GetProps(num_iid);
            product.skus       = productApiDao.GetSkus(num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(product)));
        }
        private bool CheckAddUserParameters(UserParam parameter, out string result)
        {
            if (!OpenApiHelper.CheckSystemParameters(parameter.app_key, parameter.timestamp, parameter.sign, out result))
            {
                return(false);
            }
            parameter.user_name = DataHelper.CleanSearchString(parameter.user_name);
            if (string.IsNullOrWhiteSpace(parameter.user_name))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "user_name");
                return(false);
            }
            if (MemberProcessor.FindMemberByUsername(parameter.user_name) != null)
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "user_name");
                return(false);
            }
            Regex regex  = new Regex("^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", RegexOptions.Compiled);
            Regex regex2 = new Regex("^0?(13|15|18|14|17)[0-9]{9}$", RegexOptions.Compiled);

            if (!string.IsNullOrWhiteSpace(parameter.email))
            {
                if (!regex.IsMatch(parameter.email))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "email");
                    return(false);
                }
                if (MemberProcessor.FindMemberByEmail(parameter.email) != null)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "email");
                    return(false);
                }
            }
            if (!string.IsNullOrWhiteSpace(parameter.mobile))
            {
                if (!regex2.IsMatch(parameter.mobile))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "mobile");
                    return(false);
                }
                if (MemberProcessor.FindMemberByCellphone(parameter.mobile) != null)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "mobile");
                    return(false);
                }
            }
            return(true);
        }
        private bool CheckProductParameters(SortedDictionary <string, string> parameters, out int num_iid, out string result)
        {
            num_iid = 0;
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (!OpenApiHelper.CheckSystemParameters(parameters, siteSettings.AppKey, out result))
            {
                return(false);
            }
            if (!int.TryParse(parameters["num_iid"], out num_iid))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "num_iid");
                return(false);
            }
            return(true);
        }
        private string _addUser(UserParam data)
        {
            string result = default(string);

            if (this.CheckAddUserParameters(data, out result))
            {
                SiteSettings siteSettings = HiContext.Current.SiteSettings;
                string       text         = OpenApiSign.Sign(data.SignStr(siteSettings.CheckCode), "MD5", "utf-8");
                if (text.Equals(data.sign))
                {
                    result = this.lastAddUser(data);
                    return(result);
                }
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Signature, "sign");
                return(result);
            }
            return(result);
        }
Example #17
0
        public string UpdateProductQuantity(int num_iid, string sku_id, int quantity, int type)
        {
            product_item_model productForApi = ProductHelper.GetProductForApi(num_iid);

            if (productForApi == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            if (ProductHelper.UpdateProductQuantityForApi(num_iid, sku_id, quantity, type) <= 0)
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_UpdateeQuantity_Faild, "update_quantity"));
            }
            productForApi.props_name = ProductHelper.GetPropsForApi(num_iid);
            productForApi.skus       = ProductHelper.GetSkusForApi(num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(productForApi)));
        }
        private string lastAddUser(UserParam parameter)
        {
            string     format     = "{{\"user_add_response\":{{\"user\":{{ \"uid\":\"{0}\",\"password\":\"{1}\",\"created\":\"{2}\" }} }} }}";
            MemberInfo memberInfo = new MemberInfo();

            memberInfo.GradeId   = MemberProcessor.GetDefaultMemberGrade();
            memberInfo.UserName  = parameter.user_name;
            memberInfo.RealName  = parameter.real_name;
            memberInfo.Email     = parameter.email;
            memberInfo.CellPhone = parameter.mobile;
            string text = Globals.RndStr(128, true);

            if (string.IsNullOrWhiteSpace(parameter.password))
            {
                parameter.password = Globals.RndStr(6, true);
            }
            string password = parameter.password;

            password = (memberInfo.Password = Users.EncodePassword(password, text));
            memberInfo.PasswordSalt = text;
            if (parameter.sex.IndexOf("男") >= 0)
            {
                memberInfo.Gender = Gender.Female;
            }
            else if (parameter.sex.IndexOf("女") >= 0)
            {
                memberInfo.Gender = Gender.Female;
            }
            else
            {
                memberInfo.Gender = Gender.NotSet;
            }
            memberInfo.BirthDate  = parameter.birthday;
            memberInfo.RegionId   = RegionHelper.GetRegionId(parameter.town, parameter.district, parameter.city, parameter.state);
            memberInfo.Address    = parameter.address;
            memberInfo.CreateDate = DateTime.Now;
            int num = MemberProcessor.CreateMember(memberInfo);

            if (num > 0)
            {
                return(string.Format(format, num, parameter.password, memberInfo.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.System_Error, "create user"));
        }
        private string lastUpdateProductQuantity(ProductQuantityParam param)
        {
            ProductApiDao      productApiDao = new ProductApiDao();
            product_item_model product       = productApiDao.GetProduct(param.num_iid);

            if (product == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            if (productApiDao.UpdateProductQuantity(param.num_iid, param.sku_id, param.quantity, param.type) <= 0)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_UpdateeQuantity_Faild, "update_quantity"));
            }
            product.props_name = productApiDao.GetProps(param.num_iid);
            product.skus       = productApiDao.GetSkus(param.num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(product)));
        }
        public override void OnException(HttpActionExecutedContext context)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            string jsonstr             = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.System_Error, "");

            if (context.Exception is HimallOpenApiException)
            {
                var curexp = context.Exception as HimallOpenApiException;
                jsonstr = OpenApiErrorMessage.ShowErrorMsg(curexp.ErrorCode, curexp.Message);
            }
            else
            {
                Log.Error(context.Exception.Message, context.Exception);
            }

            result.Content = new StringContent(jsonstr, Encoding.GetEncoding("UTF-8"), "application/json");

            context.Response = result;
        }
 private bool CheckUpdateApproveStatusParameters(ProductApproveStatusParam parameter, out string result)
 {
     if (!OpenApiHelper.CheckSystemParameters(parameter.app_key, parameter.timestamp, parameter.sign, out result))
     {
         return(false);
     }
     if (parameter.num_iid <= 0)
     {
         result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "num_iid");
         return(false);
     }
     parameter.approve_status = DataHelper.CleanSearchString(parameter.approve_status);
     if (parameter.approve_status != "On_Sale" && parameter.approve_status != "Un_Sale" && parameter.approve_status != "In_Stock")
     {
         result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Status_is_Invalid, "approve_status");
         return(false);
     }
     return(true);
 }
Example #22
0
        public string UpdateProductApproveStatus(int num_iid, string approve_status)
        {
            product_item_model productForApi = ProductHelper.GetProductForApi(num_iid);

            if (productForApi == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            if (ProductHelper.UpdateProductApproveStatusForApi(num_iid, approve_status) <= 0)
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_ApproveStatus_Faild, "update_approve_status"));
            }
            productForApi.props_name     = ProductHelper.GetPropsForApi(num_iid);
            productForApi.skus           = ProductHelper.GetSkusForApi(num_iid);
            productForApi.approve_status = approve_status;
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(productForApi)));
        }
Example #23
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;
            string str2   = string.Empty;

            str2 = context.Request["HIGW"];
            SortedDictionary <string, string> sortedParams = OpenApiHelper.GetSortedParams(context);

            this.site = SettingsManager.GetMasterSettings(true);
            string str3 = str2;

            if (str3 != null)
            {
                if (!(str3 == "GetSoldProducts"))
                {
                    if (str3 == "GetProduct")
                    {
                        this.GetProduct(sortedParams, ref result);
                        goto Label_00AE;
                    }
                    if (str3 == "UpdateProductQuantity")
                    {
                        this.UpdateProductQuantity(sortedParams, ref result);
                        goto Label_00AE;
                    }
                    if (str3 == "UpdateProductApproveStatus")
                    {
                        this.UpdateProductApproveStatus(sortedParams, ref result);
                        goto Label_00AE;
                    }
                }
                else
                {
                    this.GetSoldProducts(sortedParams, ref result);
                    goto Label_00AE;
                }
            }
            result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Method, "HIGW");
Label_00AE:
            context.Response.ContentType = "text/json";
            context.Response.Write(result);
        }
        public override void OnException(ExceptionContext context)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            string jsonstr             = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.System_Error, "");

            if (context.Exception is MallApiException)
            {
                var curexp = context.Exception as MallApiException;
                jsonstr = OpenApiErrorMessage.ShowErrorMsg(curexp.ErrorCode, curexp.Message);
            }
            else
            {
                Log.Error(context.Exception.Message, context.Exception);
            }

            result.Content = new StringContent(jsonstr, Encoding.GetEncoding("UTF-8"), "application/json");


            result.Content.CopyToAsync(context.HttpContext.Response.Body).Wait();
        }
        public string lastUpdateProductApproveStatus(int num_iid, string approve_status)
        {
            ProductApiDao      productApiDao = new ProductApiDao();
            product_item_model product       = productApiDao.GetProduct(num_iid);

            if (product == null)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Not_Exists, "num_iid"));
            }
            if (productApiDao.UpdateProductApproveStatus(num_iid, approve_status) <= 0)
            {
                return(OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_ApproveStatus_Faild, "update_approve_status"));
            }
            product.approve_status = approve_status;
            product.props_name     = productApiDao.GetProps(num_iid);
            product.skus           = productApiDao.GetSkus(num_iid);
            string format = "{{\"product_get_response\":{{\"item\":{0}}}}}";

            return(string.Format(format, JsonConvert.SerializeObject(product)));
        }
Example #26
0
        public void ProcessRequest(HttpContext context)
        {
            string results = string.Empty;
            string str2    = string.Empty;

            str2 = context.Request["HIGW"];
            SortedDictionary <string, string> sortedParams = OpenApiHelper.GetSortedParams(context);

            switch (str2)
            {
            case "GetSoldTrades":
                this.GetSoldTrades(sortedParams, ref results);
                break;

            case "GetTrade":
                this.GetTrade(sortedParams, ref results);
                break;

            case "GetIncrementSoldTrades":
                this.GetIncrementSoldTrades(sortedParams, ref results);
                break;

            case "SendLogistic":
                this.SendLogistic(sortedParams, ref results);
                break;

            case "UpdateTradeMemo":
                this.UpdateTradeMemo(sortedParams, ref results);
                break;

            case "ChangLogistics":
                this.ChangLogistics(sortedParams, ref results);
                break;

            default:
                results = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Method, "HIGW");
                break;
            }
            context.Response.ContentType = "text/json";
            context.Response.Write(results);
        }
Example #27
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            string s        = string.Empty;
            string text     = string.Empty;
            string arg_11_0 = string.Empty;

            text = context.Request["HIGW"];
            System.Collections.Generic.SortedDictionary <string, string> sortedParams = OpenApiHelper.GetSortedParams(context);
            string key;

            switch (key = text)
            {
            case "GetSoldTrades":
                this.GetSoldTrades(sortedParams, ref s);
                goto IL_115;

            case "GetTrade":
                this.GetTrade(sortedParams, ref s);
                goto IL_115;

            case "GetIncrementSoldTrades":
                this.GetIncrementSoldTrades(sortedParams, ref s);
                goto IL_115;

            case "SendLogistic":
                this.SendLogistic(sortedParams, ref s);
                goto IL_115;

            case "UpdateTradeMemo":
                this.UpdateTradeMemo(sortedParams, ref s);
                goto IL_115;

            case "ChangLogistics":
                this.ChangLogistics(sortedParams, ref s);
                goto IL_115;
            }
            s = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Method, "HIGW");
IL_115:
            context.Response.ContentType = "text/json";
            context.Response.Write(s);
        }
Example #28
0
        public string UpdateTradeMemo(string tid, string memo, int flag)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(tid);

            if (orderInfo == null || string.IsNullOrEmpty(orderInfo.OrderId))
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_not_Exists, "tid"));
            }
            if (flag > 0)
            {
                orderInfo.ManagerMark = new OrderMark?((OrderMark)flag);
            }
            orderInfo.ManagerRemark = Globals.HtmlEncode(memo);
            if (!OrderHelper.SaveRemark(orderInfo))
            {
                return(OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.System_Error, "save remark"));
            }
            string format = "{{\"trade_memo_update_response\":{{\"trade\":{{\"tid\":\"{0}\",\"modified\":\"{1}\"}}}}}}";

            return(string.Format(format, orderInfo.OrderId, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
        }
Example #29
0
 public bool CheckUpdateApproveStatusParameters(System.Collections.Generic.SortedDictionary <string, string> parameters, out int num_iid, out string status, out string result)
 {
     num_iid = 0;
     status  = string.Empty;
     if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
     {
         return(false);
     }
     if (!int.TryParse(parameters["num_iid"], out num_iid))
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "num_iid");
         return(false);
     }
     status = DataHelper.CleanSearchString(parameters["approve_status"]);
     if (status != "On_Sale" && status != "Un_Sale" && status != "In_Stock")
     {
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_Status_is_Invalid, "approve_status");
         return(false);
     }
     return(true);
 }
Example #30
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            string s        = string.Empty;
            string text     = string.Empty;
            string arg_11_0 = string.Empty;

            text = context.Request["HIGW"];
            System.Collections.Generic.SortedDictionary <string, string> sortedParams = OpenApiHelper.GetSortedParams(context);
            this.site = SettingsManager.GetMasterSettings(true);
            string a;

            if ((a = text) != null)
            {
                if (a == "GetSoldProducts")
                {
                    this.GetSoldProducts(sortedParams, ref s);
                    goto IL_AE;
                }
                if (a == "GetProduct")
                {
                    this.GetProduct(sortedParams, ref s);
                    goto IL_AE;
                }
                if (a == "UpdateProductQuantity")
                {
                    this.UpdateProductQuantity(sortedParams, ref s);
                    goto IL_AE;
                }
                if (a == "UpdateProductApproveStatus")
                {
                    this.UpdateProductApproveStatus(sortedParams, ref s);
                    goto IL_AE;
                }
            }
            s = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Method, "HIGW");
IL_AE:
            context.Response.ContentType = "text/json";
            context.Response.Write(s);
        }