Example #1
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 #2
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);
 }
Example #3
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 #4
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 #5
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);
 }
 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 #7
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);
 }
        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 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 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 #12
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);
        }
Example #13
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 #14
0
 public bool CheckUpdateApproveStatusParameters(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 #15
0
        private bool CheckUpdateTradeMemoParameters(SortedDictionary <string, string> parameters, out int flag, ref string result)
        {
            flag = 0;
            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["flag"])))
            {
                if (!int.TryParse(DataHelper.CleanSearchString(parameters["flag"]), out flag))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "flag");
                    return(false);
                }
                if ((flag < 1) || (flag > 6))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Flag_Too_Long, "flag");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["memo"])) && (DataHelper.CleanSearchString(parameters["memo"]).Length > 300))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Memo_Too_Long, "memo");
                return(false);
            }
            Regex regex = new Regex("^(?!_)(?!.*?_$)(?!-)(?!.*?-$)[a-zA-Z0-9._一-龥-]+$");

            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["memo"])) && !regex.IsMatch(DataHelper.CleanSearchString(parameters["memo"])))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "memo");
                return(false);
            }
            return(true);
        }
Example #16
0
        public bool CheckSoldProductsParameters(SortedDictionary <string, string> parameters, out DateTime?start_modified, out DateTime?end_modified, out string status, out int page_no, out int page_size, out string result)
        {
            DateTime time2;

            start_modified = new DateTime?();
            end_modified   = new DateTime?();
            status         = string.Empty;
            page_no        = 1;
            page_size      = 10;
            if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
            {
                return(false);
            }
            status = DataHelper.CleanSearchString(parameters["approve_status"]);
            if ((!string.IsNullOrWhiteSpace(status) && (status != "On_Sale")) && ((status != "Un_Sale") && (status != "In_Stock")))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Product_Status_is_Invalid, "approve_status");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["start_modified"]) && !OpenApiHelper.IsDate(parameters["start_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "start_modified");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["end_modified"]) && !OpenApiHelper.IsDate(parameters["end_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "end_modified");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["start_modified"]))
            {
                DateTime time;
                DateTime.TryParse(parameters["start_modified"], out time);
                start_modified = new DateTime?(time);
                if (time > DateTime.Now)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_Now, "start_modified and currenttime");
                    return(false);
                }
                if (!string.IsNullOrEmpty(parameters["end_modified"]))
                {
                    DateTime.TryParse(parameters["end_modified"], out time2);
                    end_modified = new DateTime?(time2);
                    if (time > time2)
                    {
                        result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_End, "start_modified and end_created");
                        return(false);
                    }
                    if (time2 > DateTime.Now)
                    {
                        result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_modified and currenttime");
                        return(false);
                    }
                }
            }
            else if (!string.IsNullOrEmpty(parameters["end_modified"]))
            {
                DateTime.TryParse(parameters["end_modified"], out time2);
                if (time2 > DateTime.Now)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_modified and currenttime");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(parameters["order_by"]))
            {
                if (parameters["order_by"].Split(new char[] { ':' }).Length != 2)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
                string[] strArray = parameters["order_by"].Split(new char[] { ':' });
                string   str      = DataHelper.CleanSearchString(strArray[0]);
                string   str2     = DataHelper.CleanSearchString(strArray[1]);
                if (string.IsNullOrEmpty(str))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
                if (((str != "display_sequence") || (str != "create_time")) || (str != "sold_quantity"))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
                if ((str2 != "desc") || (str2 != "asc"))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && !int.TryParse(parameters["page_size"].ToString(), out page_size))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && ((page_size <= 0) || (page_size > 100)))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Page_Size_Too_Long, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && !int.TryParse(parameters["page_no"].ToString(), out page_no))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "page_no");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && (page_no <= 0))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Page_Size_Too_Long, "page_no");
                return(false);
            }
            return(true);
        }
        private bool CheckSoldProductsParameters(SortedDictionary <string, string> parameters, out DateTime?start_modified, out DateTime?end_modified, out string status, out int page_no, out int page_size, out string result)
        {
            start_modified = null;
            end_modified   = null;
            status         = string.Empty;
            page_no        = 1;
            page_size      = 10;
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (!OpenApiHelper.CheckSystemParameters(parameters, siteSettings.AppKey, out result))
            {
                return(false);
            }
            status = DataHelper.CleanSearchString(parameters["approve_status"]);
            if (!string.IsNullOrWhiteSpace(status) && status != "On_Sale" && status != "Un_Sale" && status != "In_Stock")
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Product_Status_is_Invalid, "approve_status");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["start_modified"]) && !OpenApiHelper.IsDate(parameters["start_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Timestamp, "start_modified");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["end_modified"]) && !OpenApiHelper.IsDate(parameters["end_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Timestamp, "end_modified");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["start_modified"]))
            {
                DateTime dateTime = default(DateTime);
                DateTime.TryParse(parameters["start_modified"], out dateTime);
                start_modified = dateTime;
                if (dateTime > DateTime.Now)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Time_Start_Now, "start_modified and currenttime");
                    return(false);
                }
                if (!string.IsNullOrEmpty(parameters["end_modified"]))
                {
                    DateTime dateTime2 = default(DateTime);
                    DateTime.TryParse(parameters["end_modified"], out dateTime2);
                    end_modified = dateTime2;
                    if (dateTime > dateTime2)
                    {
                        result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Time_Start_End, "start_modified and end_created");
                        return(false);
                    }
                }
            }
            if (!string.IsNullOrEmpty(parameters["order_by"]))
            {
                if (parameters["order_by"].Split(':').Length != 2)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
                string[] array = parameters["order_by"].Split(':');
                string   text  = DataHelper.CleanSearchString(array[0]);
                string   a     = DataHelper.CleanSearchString(array[1]);
                if (string.IsNullOrEmpty(text))
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
                if (text != "display_sequence" || text != "create_time" || text != "sold_quantity")
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
                if (a != "desc" || a != "asc")
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Format, "order_by");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && !int.TryParse(parameters["page_size"].ToString(), out page_size))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && (page_size <= 0 || page_size > 100))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Page_Size_Too_Long, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && !int.TryParse(parameters["page_no"].ToString(), out page_no))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "page_no");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && page_no <= 0)
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Page_Size_Too_Long, "page_no");
                return(false);
            }
            return(true);
        }
Example #18
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);
        }
        private bool CheckUsersParameters(SortedDictionary <string, string> parameters, out DateTime?start_time, out DateTime?end_time, out int page_no, out int page_size, out string result)
        {
            start_time = null;
            end_time   = null;
            page_no    = 1;
            page_size  = 40;
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (!OpenApiHelper.CheckSystemParameters(parameters, siteSettings.AppKey, out result))
            {
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["start_time"]) && !OpenApiHelper.IsDate(parameters["start_time"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Timestamp, "start_time");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["end_time"]) && !OpenApiHelper.IsDate(parameters["end_time"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Invalid_Timestamp, "end_time");
                return(false);
            }
            if (!string.IsNullOrEmpty(parameters["start_time"]))
            {
                DateTime dateTime = default(DateTime);
                DateTime.TryParse(parameters["start_time"], out dateTime);
                start_time = dateTime;
                if (dateTime > DateTime.Now)
                {
                    result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Time_Start_Now, "start_time and currenttime");
                    return(false);
                }
                if (!string.IsNullOrEmpty(parameters["end_time"]))
                {
                    DateTime dateTime2 = default(DateTime);
                    DateTime.TryParse(parameters["end_time"], out dateTime2);
                    end_time = dateTime2;
                    if (dateTime > dateTime2)
                    {
                        result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Time_Start_End, "start_time and end_created");
                        return(false);
                    }
                }
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && !int.TryParse(parameters["page_size"].ToString(), out page_size))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && (page_size <= 0 || page_size > 100))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Page_Size_Too_Long, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && !int.TryParse(parameters["page_no"].ToString(), out page_no))
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Parameters_Format_Error, "page_no");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && page_no <= 0)
            {
                result = OpenApiErrorMessage.ShowErrorMsg((Enum)(object)OpenApiErrorCode.Page_Size_Too_Long, "page_no");
                return(false);
            }
            return(true);
        }
Example #20
0
 private bool CheckSoldTradesParameters(SortedDictionary <string, string> parameters, out DateTime?start_time, out DateTime?end_time, out string status, out int page_no, out int page_size, ref string result)
 {
     start_time = new DateTime?();
     end_time   = new DateTime?();
     page_size  = 10;
     page_no    = 1;
     status     = DataHelper.CleanSearchString(parameters["status"]);
     if (OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
     {
         DateTime time2;
         if (!string.IsNullOrEmpty(parameters["start_created"]) && !OpenApiHelper.IsDate(parameters["start_created"]))
         {
             result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "start_created");
             return(false);
         }
         if (!string.IsNullOrEmpty(parameters["end_created"]) && !OpenApiHelper.IsDate(parameters["end_created"]))
         {
             result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "end_created");
             return(false);
         }
         if (!string.IsNullOrEmpty(parameters["start_created"]))
         {
             DateTime time;
             DateTime.TryParse(parameters["start_created"], out time);
             start_time = new DateTime?(time);
             if (time > DateTime.Now)
             {
                 result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_Now, "start_created and currenttime");
                 return(false);
             }
             if (!string.IsNullOrEmpty(parameters["end_created"]))
             {
                 DateTime.TryParse(parameters["end_created"], out time2);
                 end_time = new DateTime?(time2);
                 if (time > time2)
                 {
                     result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_End, "start_created and end_created");
                     return(false);
                 }
                 if (time2 > DateTime.Now)
                 {
                     result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_created and currenttime");
                     return(false);
                 }
             }
         }
         else if (!string.IsNullOrEmpty(parameters["end_created"]))
         {
             DateTime.TryParse(parameters["end_created"], out time2);
             if (time2 > DateTime.Now)
             {
                 result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_created and currenttime");
                 return(false);
             }
         }
         if (((!string.IsNullOrWhiteSpace(status) && (status != "WAIT_BUYER_PAY")) && ((status != "WAIT_SELLER_SEND_GOODS") && (status != "WAIT_BUYER_CONFIRM_GOODS"))) && ((status != "TRADE_CLOSED") && (status != "TRADE_FINISHED")))
         {
             result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_is_Invalid, "status");
             return(false);
         }
         if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && !int.TryParse(parameters["page_no"].ToString(), out page_no))
         {
             result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "page_no");
             return(false);
         }
         if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && (page_no <= 0))
         {
             result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Page_Size_Too_Long, "page_no");
             return(false);
         }
         if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && !int.TryParse(parameters["page_size"].ToString(), out page_size))
         {
             result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "page_size");
             return(false);
         }
         if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) || ((page_size > 0) && (page_size <= 100)))
         {
             return(true);
         }
         result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Page_Size_Too_Long, "page_size");
     }
     return(false);
 }
Example #21
0
        private bool CheckIncrementSoldTradesParameters(SortedDictionary <string, string> parameters, out DateTime start_modified, out DateTime end_modified, out string status, out int page_no, out int page_size, ref string result)
        {
            start_modified = DateTime.Now;
            end_modified   = DateTime.Now;
            page_size      = 10;
            page_no        = 1;
            status         = DataHelper.CleanSearchString(parameters["status"]);
            if (!OpenApiHelper.CheckSystemParameters(parameters, this.site.AppKey, out result))
            {
                return(false);
            }
            if (((!string.IsNullOrWhiteSpace(status) && (status != "WAIT_BUYER_PAY")) && ((status != "WAIT_SELLER_SEND_GOODS ") && (status != "WAIT_BUYER_CONFIRM_GOODS"))) && ((status != "TRADE_CLOSED") && (status != "TRADE_FINISHED")))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Trade_Status_is_Invalid, "status");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && !int.TryParse(parameters["page_size"].ToString(), out page_size))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && ((page_size <= 0) || (page_size > 100)))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Page_Size_Too_Long, "page_size");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && !int.TryParse(parameters["page_no"].ToString(), out page_no))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Parameters_Format_Error, "page_no");
                return(false);
            }
            if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && (page_no <= 0))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Page_Size_Too_Long, "page_no");
                return(false);
            }
            if (string.IsNullOrEmpty(parameters["start_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "start_modified");
                return(false);
            }
            if (!OpenApiHelper.IsDate(parameters["start_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "start_modified");
                return(false);
            }
            DateTime.TryParse(parameters["start_modified"], out start_modified);
            if (start_modified > DateTime.Now)
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_Now, "start_modified and currenttime");
                return(false);
            }
            if (string.IsNullOrEmpty(parameters["end_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Missing_Required_Arguments, "end_modified");
                return(false);
            }
            if (!OpenApiHelper.IsDate(parameters["end_modified"]))
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Timestamp, "end_modified");
                return(false);
            }
            DateTime.TryParse(parameters["end_modified"], out end_modified);
            if (start_modified > end_modified)
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_End, "start_modified and end_modified");
                return(false);
            }
            TimeSpan span = (TimeSpan)(end_modified - start_modified);

            if (span.TotalDays > 1.0)
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_StartModified_AND_EndModified, "start_modified and end_modified");
                return(false);
            }
            if (end_modified > DateTime.Now)
            {
                result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_modified and currenttime");
                return(false);
            }
            return(true);
        }
Example #22
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);
        }