public void ProcessRequest(HttpContext context) { this.CommonClientRef = new Common(); DecryptQueryString(context.Request); string path = string.Empty; if (this.queryString["UploadPath"] != null) { path = this.queryString["UploadPath"].ToString(); } HttpPostedFile fileToUpload = context.Request.Files["Filedata"]; string pathToSave = (path.EndsWith("\\") ? path : path + "\\") + fileToUpload.FileName; fileToUpload.SaveAs(pathToSave); #region Save Entity this.currentEntity = new UploadedFile(); string[] user = path.Split('_'); string[] resName = user.First().Split('\\'); FileInfo fi = new FileInfo(pathToSave); currentEntity.idResource = Convert.ToInt32(user.Last()); currentEntity.ResourceName = resName.Last(); currentEntity.FilePath = pathToSave; currentEntity.FileName = fileToUpload.FileName; currentEntity.Extension = Path.GetExtension(fileToUpload.FileName).Substring(1); currentEntity.DateUpload = DateTime.Now; currentEntity.Size = Convert.ToInt32(fi.Length / (1024));// в KБ //currentEntity.ContentType = CallContext resultContext = new CallContext(); resultContext.CurrentConsumerID = user.Last(); resultContext = CommonClientRef.UploadedFileSave(currentEntity, resultContext); #endregion }
protected override void OnInit(EventArgs e) { LogDebug("GeneralPage OnInit"); this.BaseHelperObj = new ETEMModel.Helpers.BaseHelper(); this.AdminClientRef = new Administration(); this.CommonClientRef = new Common(); this.EmployeClientRef = new EmployeRef(); this.CostCalculationRef = new ETEMModel.Services.CostCalculation.CostCalculationRef(); this.CallContext = new CallContext(); this.FormContext = new FormContext(); this.FormContext.RequestMeasure = new RequestMeasure(this.Page.GetType().FullName); this.FormContext.UserProps = this.UserProps; this.FormContext.DictionaryKeyValue = DictionaryKeyValue; this.FormContext.DictionaryKeyType = DictionaryKeyType; this.FormContext.DictionarySetting = DictionarySetting; AdminClientRef.DictionaryKeyType = DictionaryKeyType; AdminClientRef.DictionaryKeyValue = DictionaryKeyValue; this.FormContext.DictionaryPermittedActionSetting = DictionaryPermittedActionSetting; //Функционалност за разкрептиране на криптираните ключове в QueryString_а if (Request.QueryString.Count > 0) { string rawQueryString = System.Web.HttpUtility.UrlDecode(Request.RawUrl.Substring(Request.RawUrl.IndexOf('?') + 1)); string queryString = ""; if (rawQueryString.IndexOf("Cript=false") == -1) { queryString = ETEMModel.Helpers.BaseHelper.Decrypt(rawQueryString); } else { queryString = rawQueryString; } string val; string key; string[] keys_values = queryString.Split('&'); foreach (string key_value in keys_values) { string[] kv = key_value.Split('='); key = kv[0]; val = kv[1]; this.FormContext.QueryString.Add(key, val); } } if (userProps != null) { userProps.LastRequestDateTime = DateTime.Now; userProps.Page = this.Page.GetType().FullName; } base.OnInit(e); }
public Main() { this.commonClientRef = new Common(); }