private void SaveLabelInfo(ShippingLabelInfo info) { try { AspxCommonInfo commonObj = new AspxCommonInfo(); commonObj.StoreID = storeId; commonObj.PortalID = portalId; commonObj.UserName = GetUsername; AspxShipProviderMgntController ctl = new AspxShipProviderMgntController(); ctl.SaveShippingLabelInfo(info, commonObj); } catch (Exception ex) { throw ex; } }
private bool CheckLabelExist(int orderId) { try { AspxShipProviderMgntController ctl = new AspxShipProviderMgntController(); AspxCommonInfo commonObj = new AspxCommonInfo(); commonObj.StoreID = _storeId; commonObj.PortalID = _portalId; bool isExist = ctl.IsShippingLabelCreated(orderId, commonObj); return(isExist); } catch (Exception ex) { throw ex; } }
private bool CheckLabelExist(int orderId) { try { AspxShipProviderMgntController ctl = new AspxShipProviderMgntController(); AspxCommonInfo commonObj = new AspxCommonInfo(); commonObj.StoreID = _storeId; commonObj.PortalID = _portalId; bool isExist = ctl.IsShippingLabelCreated(orderId, commonObj); return isExist; } catch (Exception ex) { throw ex; } }
private void GetLabelDetail(int orderId, int storeId, int portalId) { try { AspxShipProviderMgntController ctl = new AspxShipProviderMgntController(); AspxCommonInfo commonObj = new AspxCommonInfo(); commonObj.StoreID = storeId; commonObj.PortalID = portalId; ShippingLabelInfo detail = ctl.GetShippingLabelInfo(orderId, commonObj); DisplayFile(detail); } catch (Exception ex) { throw ex; } }
private void GetLabelDetail(int orderId, int storeId, int portalId) { try { AspxShipProviderMgntController ctl = new AspxShipProviderMgntController(); AspxCommonInfo commonObj = new AspxCommonInfo(); commonObj.StoreID = storeId; commonObj.PortalID = portalId; ShippingLabelInfo detail = ctl.GetShippingLabelInfo(orderId, commonObj); DisplayFile(detail); } catch (Exception ex) { throw ex; } }
private void SaveLabelInfo(ShippingLabelInfo info) { try { AspxCommonInfo commonObj = new AspxCommonInfo(); commonObj.StoreID = _storeId; commonObj.PortalID = _portalId; commonObj.UserName = GetUsername; AspxShipProviderMgntController ctl = new AspxShipProviderMgntController(); ctl.SaveShippingLabelInfo(info, commonObj); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { try { bool isValidFile = false; string validExtension = string.Empty; string retFilePath = string.Empty; string retMsg = "fail"; int maxFileSize = 0; int retStatus = -1; string strBaseLocation = string.Empty; string filename = string.Empty; bool isRepair = false; _commonInfo.CultureName = GetCurrentCultureName; var rnd = new Random(); var shippingMethodList = string.Empty; if (Request.Form["StoreId"] != null) { _commonInfo.StoreID = int.Parse(Request.Form["StoreId"].ToString()); } if (Request.Form["PortalId"] != null) { _commonInfo.PortalID = int.Parse(Request.Form["PortalId"].ToString()); } if (Request.Form["ValidExtension"] != null) { validExtension = Request.Form["ValidExtension"].ToString(); } if (Request.Form["BaseLocation"] != null) { strBaseLocation = Request.Form["BaseLocation"].ToString(); } if (Request.Form["MaxFileSize"] != null && Request.Form["MaxFileSize"] != "" && int.Parse(Request.Form["MaxFileSize"].ToString()) > 0) { maxFileSize = int.Parse(Request.Form["MaxFileSize"].ToString()); } if (Request.Form["IsRepair"] != null) { isRepair = bool.Parse(Request.Form["IsRepair"].ToString()); } if (Request.Form["UserName"] != null) { _commonInfo.UserName = Request.Form["UserName"].ToString(); } if (Request.Files != null) { HttpFileCollection files = Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; if (file.ContentLength > 0 && file.ContentLength < maxFileSize*1024) { if (validExtension.Length > 0) { string[] allowExtensions = validExtension.Split(' '); if (allowExtensions.Contains(GetExtension(file.FileName), StringComparer.InvariantCultureIgnoreCase)) { isValidFile = true; retMsg = "Valid file Extension"; } else { retMsg = "Not valid file Extension"; } } else { isValidFile = true; } if (isValidFile) { retFilePath = strBaseLocation; strBaseLocation = Server.MapPath("~/" + strBaseLocation); if (!Directory.Exists(strBaseLocation)) { Directory.CreateDirectory(strBaseLocation); } else { DeleteTempDirectory(strBaseLocation); Directory.CreateDirectory(strBaseLocation); } filename = System.IO.Path.GetFileName(file.FileName); string strExtension = GetExtension(filename); filename = filename.Substring(0, (filename.Length - strExtension.Length) - 1); filename = filename + '_' + rnd.Next(111111, 999999).ToString() + '.' + strExtension; string filePath = strBaseLocation + "\\" + filename; retFilePath = retFilePath + "/" + filename; file.SaveAs(filePath); int value = ReadZip(strBaseLocation, filename); switch (value) { case 1: CopyDlltoBin(); var obj = (Dictionary<string, string>) DynamicMethodInvoke(_provider.AssemblyName, _provider.ShippingProviderNamespace, _provider.ShippingProviderClass, "GetAvailableServiceMethod"); shippingMethodList = JSONHelper.Serialize<Dictionary<string, string>>(obj); _provider.TempFolderPath = Regex.Replace(_provider.TempFolderPath, @"(\\)", @"//"); _provider.ExtractedPath = Regex.Replace(_provider.ExtractedPath, @"(\\)", @"//"); if (!string.IsNullOrEmpty(_provider.InstallScript)) ReadSQLFile(_provider.ExtractedPath, _provider.InstallScript); retMsg = "Successfully read shipping provider data."; AspxShipProviderMgntController objProvider = new AspxShipProviderMgntController(); string keys = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Key + "#")); string values = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Value + "#")); objProvider.SaveUpdateProviderSetting(_provider, keys, values, _commonInfo); retStatus = 1; break; case 2: retMsg = "Shipping provider already exist!"; retStatus = -1; if (isRepair) { UninstallShippingProvider(_provider); CopyDlltoBin(); var obj1 = (Dictionary<string, string>) DynamicMethodInvoke(_provider.AssemblyName, _provider.ShippingProviderNamespace, _provider.ShippingProviderClass, "GetAvailableServiceMethod"); shippingMethodList = JSONHelper.Serialize<Dictionary<string, string>>(obj1); _provider.TempFolderPath = Regex.Replace(_provider.TempFolderPath, @"(\\)", @"//"); _provider.ExtractedPath = Regex.Replace(_provider.ExtractedPath, @"(\\)", @"//"); if (!string.IsNullOrEmpty(_provider.InstallScript)) ReadSQLFile(_provider.ExtractedPath, _provider.InstallScript); AspxShipProviderMgntController objProvider1 = new AspxShipProviderMgntController(); string key = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Key + "#")); string keyvalue = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Value + "#")); objProvider1.SaveUpdateProviderSetting(_provider, key, keyvalue,_commonInfo); retMsg = "Successfully read shipping provider data."; retStatus = 1; } break; case 3: retMsg = "Invalid shipping providers zip!"; retStatus = -1; break; case 4: retMsg = "Invalid shipping providers manifest file!"; retStatus = -1; break; } } } else { retMsg = "Sorry, the file must be less than " + maxFileSize + "KB"; } } } var lit = new Literal(); lit.Text = "<pre id='response'>({ 'Status': '" + retStatus + "','Methods' :'" + shippingMethodList + "','Message': '" + retMsg + "','UploadedPath': '" + retFilePath + "' })</pre>"; this.Page.Form.Controls.Add(lit); } catch (Exception ex) { var lit = new Literal(); lit.Text = "<pre id='response'>({ 'Status': '" + -1 + "','Methods' :'" + "" + "','Message': '/" + ex.Message + "/','UploadedPath': '" + "" + "' })</pre>"; this.Page.Form.Controls.Add(lit); } }
protected void Page_Load(object sender, EventArgs e) { try { bool isValidFile = false; string validExtension = string.Empty; string retFilePath = string.Empty; string retMsg = "fail"; int maxFileSize = 0; int retStatus = -1; string strBaseLocation = string.Empty; string filename = string.Empty; bool isRepair = false; _commonInfo.CultureName = GetCurrentCultureName; var rnd = new Random(); var shippingMethodList = string.Empty; if (Request.Form["StoreId"] != null) { _commonInfo.StoreID = int.Parse(Request.Form["StoreId"].ToString()); } if (Request.Form["PortalId"] != null) { _commonInfo.PortalID = int.Parse(Request.Form["PortalId"].ToString()); } if (Request.Form["ValidExtension"] != null) { validExtension = Request.Form["ValidExtension"].ToString(); } if (Request.Form["BaseLocation"] != null) { strBaseLocation = Request.Form["BaseLocation"].ToString(); } if (Request.Form["MaxFileSize"] != null && Request.Form["MaxFileSize"] != "" && int.Parse(Request.Form["MaxFileSize"].ToString()) > 0) { maxFileSize = int.Parse(Request.Form["MaxFileSize"].ToString()); } if (Request.Form["IsRepair"] != null) { isRepair = bool.Parse(Request.Form["IsRepair"].ToString()); } if (Request.Form["UserName"] != null) { _commonInfo.UserName = Request.Form["UserName"].ToString(); } if (Request.Files != null) { HttpFileCollection files = Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; if (file.ContentLength > 0 && file.ContentLength < maxFileSize * 1024) { if (validExtension.Length > 0) { string[] allowExtensions = validExtension.Split(' '); if (allowExtensions.Contains(GetExtension(file.FileName), StringComparer.InvariantCultureIgnoreCase)) { isValidFile = true; retMsg = "Valid file Extension"; } else { retMsg = "Not valid file Extension"; } } else { isValidFile = true; } if (isValidFile) { retFilePath = strBaseLocation; strBaseLocation = Server.MapPath("~/" + strBaseLocation); if (!Directory.Exists(strBaseLocation)) { Directory.CreateDirectory(strBaseLocation); } else { DeleteTempDirectory(strBaseLocation); Directory.CreateDirectory(strBaseLocation); } filename = System.IO.Path.GetFileName(file.FileName); string strExtension = GetExtension(filename); filename = filename.Substring(0, (filename.Length - strExtension.Length) - 1); filename = filename + '_' + rnd.Next(111111, 999999).ToString() + '.' + strExtension; string filePath = strBaseLocation + "\\" + filename; retFilePath = retFilePath + "/" + filename; file.SaveAs(filePath); int value = ReadZip(strBaseLocation, filename); switch (value) { case 1: CopyDlltoBin(); var obj = (Dictionary <string, string>) DynamicMethodInvoke(_provider.AssemblyName, _provider.ShippingProviderNamespace, _provider.ShippingProviderClass, "GetAvailableServiceMethod"); shippingMethodList = JSONHelper.Serialize <Dictionary <string, string> >(obj); _provider.TempFolderPath = Regex.Replace(_provider.TempFolderPath, @"(\\)", @"//"); _provider.ExtractedPath = Regex.Replace(_provider.ExtractedPath, @"(\\)", @"//"); if (!string.IsNullOrEmpty(_provider.InstallScript)) { ReadSQLFile(_provider.ExtractedPath, _provider.InstallScript); } retMsg = "Successfully read shipping provider data."; AspxShipProviderMgntController objProvider = new AspxShipProviderMgntController(); string keys = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Key + "#")); string values = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Value + "#")); objProvider.SaveUpdateProviderSetting(_provider, keys, values, _commonInfo); retStatus = 1; break; case 2: retMsg = "Shipping provider already exist!"; retStatus = -1; if (isRepair) { UninstallShippingProvider(_provider); CopyDlltoBin(); var obj1 = (Dictionary <string, string>) DynamicMethodInvoke(_provider.AssemblyName, _provider.ShippingProviderNamespace, _provider.ShippingProviderClass, "GetAvailableServiceMethod"); shippingMethodList = JSONHelper.Serialize <Dictionary <string, string> >(obj1); _provider.TempFolderPath = Regex.Replace(_provider.TempFolderPath, @"(\\)", @"//"); _provider.ExtractedPath = Regex.Replace(_provider.ExtractedPath, @"(\\)", @"//"); if (!string.IsNullOrEmpty(_provider.InstallScript)) { ReadSQLFile(_provider.ExtractedPath, _provider.InstallScript); } AspxShipProviderMgntController objProvider1 = new AspxShipProviderMgntController(); string key = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Key + "#")); string keyvalue = _provider.Settings.Aggregate("", (current, setting) => current + (setting.Value + "#")); objProvider1.SaveUpdateProviderSetting(_provider, key, keyvalue, _commonInfo); retMsg = "Successfully read shipping provider data."; retStatus = 1; } break; case 3: retMsg = "Invalid shipping providers zip!"; retStatus = -1; break; case 4: retMsg = "Invalid shipping providers manifest file!"; retStatus = -1; break; } } } else { retMsg = "Sorry, the file must be less than " + maxFileSize + "KB"; } } } var lit = new Literal(); lit.Text = "<pre id='response'>({ 'Status': '" + retStatus + "','Methods' :'" + shippingMethodList + "','Message': '" + retMsg + "','UploadedPath': '" + retFilePath + "' })</pre>"; this.Page.Form.Controls.Add(lit); } catch (Exception ex) { var lit = new Literal(); lit.Text = "<pre id='response'>({ 'Status': '" + -1 + "','Methods' :'" + "" + "','Message': '/" + ex.Message + "/','UploadedPath': '" + "" + "' })</pre>"; this.Page.Form.Controls.Add(lit); } }