public string UploadFileDoc(string fileName, int DocTypeId, ASPxUploadControl ctrl, object mapId)
        {
            string MId = mapId.ToString();
            string dir = "~/Documents/" + HttpContext.Current.Session["UserName"] + "/" + HttpContext.Current.Session["DurationId"] + "/" + DocTypeId + "/" + MId + "/";
            bool isExist = System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(dir));
            if (!isExist)
            {
                System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(dir));
            }

            Doc_Main x = new Doc_Main();
            x.Path = dir + fileName;
            x.UserName = HttpContext.Current.Session["UserName"].ToString();
            x.DurationId = Convert.ToInt32(HttpContext.Current.Session["DurationId"]);
            x.FileName = fileName;
            x.DocumentTypeId = DocTypeId;
            x.MapId = MId;
            db.Doc_Mains.InsertOnSubmit(x);
            db.SubmitChanges();

            return dir;
        }
		private void detach_Doc_Mains(Doc_Main entity)
		{
			this.SendPropertyChanging();
			entity.Doc_Type = null;
		}
		private void attach_Doc_Mains(Doc_Main entity)
		{
			this.SendPropertyChanging();
			entity.Doc_Type = this;
		}
 partial void DeleteDoc_Main(Doc_Main instance);
 partial void UpdateDoc_Main(Doc_Main instance);
 partial void InsertDoc_Main(Doc_Main instance);