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); }
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 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); }
public bool CheckProductParameters(System.Collections.Generic.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); }
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); }
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); }
private bool CheckIncrementSoldTradesParameters(System.Collections.Generic.SortedDictionary <string, string> parameters, out System.DateTime start_modified, out System.DateTime end_modified, out string status, out int page_no, out int page_size, ref string result) { start_modified = System.DateTime.Now; end_modified = System.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); } System.DateTime.TryParse(parameters["start_modified"], out start_modified); if (start_modified > System.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); } System.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); } if ((end_modified - start_modified).TotalDays > 1.0) { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_StartModified_AND_EndModified, "start_modified and end_modified"); return(false); } if (end_modified > System.DateTime.Now) { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_modified and currenttime"); return(false); } return(true); }
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); }
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) { 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((Enum)OpenApiErrorCode.Product_Status_is_Invalid, "approve_status"); return(false); } else if (!string.IsNullOrEmpty(parameters["start_modified"]) && !OpenApiHelper.IsDate(parameters["start_modified"])) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Invalid_Timestamp, "start_modified"); return(false); } else if (!string.IsNullOrEmpty(parameters["end_modified"]) && !OpenApiHelper.IsDate(parameters["end_modified"])) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Invalid_Timestamp, "end_modified"); return(false); } else { if (!string.IsNullOrEmpty(parameters["start_modified"])) { DateTime result1; DateTime.TryParse(parameters["start_modified"], out result1); start_modified = new DateTime?(result1); if (result1 > DateTime.Now) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Time_Start_Now, "start_modified and currenttime"); return(false); } else if (!string.IsNullOrEmpty(parameters["end_modified"])) { DateTime result2; DateTime.TryParse(parameters["end_modified"], out result2); end_modified = new DateTime?(result2); if (result1 > result2) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Time_Start_End, "start_modified and end_created"); return(false); } else if (result2 > DateTime.Now) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Time_End_Now, "end_modified and currenttime"); return(false); } } } else if (!string.IsNullOrEmpty(parameters["end_modified"])) { DateTime result1; DateTime.TryParse(parameters["end_modified"], out result1); if (result1 > DateTime.Now) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Time_End_Now, "end_modified and currenttime"); return(false); } } if (!string.IsNullOrEmpty(parameters["order_by"])) { if (parameters["order_by"].Split(':').Length != 2) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Invalid_Format, "order_by"); return(false); } else { string[] strArray = parameters["order_by"].Split(':'); string str1 = DataHelper.CleanSearchString(strArray[0]); string str2 = DataHelper.CleanSearchString(strArray[1]); if (string.IsNullOrEmpty(str1)) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Invalid_Format, "order_by"); return(false); } else if (str1 != "display_sequence" || str1 != "create_time" || str1 != "sold_quantity") { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Invalid_Format, "order_by"); return(false); } else if (str2 != "desc" || str2 != "asc") { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Invalid_Format, "order_by"); return(false); } } } if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && !int.TryParse(((object)parameters["page_size"]).ToString(), out page_size)) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Parameters_Format_Error, "page_size"); return(false); } else if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_size"])) && (page_size <= 0 || page_size > 100)) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Page_Size_Too_Long, "page_size"); return(false); } else if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) && !int.TryParse(((object)parameters["page_no"]).ToString(), out page_no)) { result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Parameters_Format_Error, "page_no"); return(false); } else { if (string.IsNullOrEmpty(DataHelper.CleanSearchString(parameters["page_no"])) || page_no > 0) { return(true); } result = OpenApiErrorMessage.ShowErrorMsg((Enum)OpenApiErrorCode.Page_Size_Too_Long, "page_no"); return(false); } } }
public bool CheckSoldProductsParameters(System.Collections.Generic.SortedDictionary <string, string> parameters, out System.DateTime?start_modified, out System.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; 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"])) { System.DateTime dateTime; System.DateTime.TryParse(parameters["start_modified"], out dateTime); start_modified = new System.DateTime?(dateTime); if (dateTime > System.DateTime.Now) { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_Now, "start_modified and currenttime"); return(false); } if (!string.IsNullOrEmpty(parameters["end_modified"])) { System.DateTime dateTime2; System.DateTime.TryParse(parameters["end_modified"], out dateTime2); end_modified = new System.DateTime?(dateTime2); if (dateTime > dateTime2) { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_Start_End, "start_modified and end_created"); return(false); } if (dateTime2 > System.DateTime.Now) { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Time_End_Now, "end_modified and currenttime"); return(false); } } } else if (!string.IsNullOrEmpty(parameters["end_modified"])) { System.DateTime dateTime2; System.DateTime.TryParse(parameters["end_modified"], out dateTime2); if (dateTime2 > System.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[] array = parameters["order_by"].Split(new char[] { ':' }); string text = DataHelper.CleanSearchString(array[0]); string a = DataHelper.CleanSearchString(array[1]); if (string.IsNullOrEmpty(text)) { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Format, "order_by"); return(false); } if (text != "display_sequence" || text != "create_time" || text != "sold_quantity") { result = OpenApiErrorMessage.ShowErrorMsg(OpenApiErrorCode.Invalid_Format, "order_by"); return(false); } if (a != "desc" || a != "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); }