private ServicesInfor.Album_Photo SetItemSyn(double News_ID) { HPCBusinessLogic.DAL.T_Album_PhotoDAL _untilDAL = new HPCBusinessLogic.DAL.T_Album_PhotoDAL(); ServicesInfor.Album_Photo obj = new ServicesInfor.Album_Photo(); HPCInfo.T_Album_Photo objGet = new HPCInfo.T_Album_Photo(); objGet = _untilDAL.load_T_Album_Photo(int.Parse(News_ID.ToString())); obj.Alb_Photo_ID = objGet.Alb_Photo_ID; obj.Cat_Album_ID = objGet.Cat_Album_ID; obj.Lang_ID = objGet.Lang_ID; obj.Abl_Photo_Name = objGet.Abl_Photo_Name; obj.Abl_Photo_Desc = objGet.Abl_Photo_Desc; obj.Abl_Isweek_Photo = objGet.Abl_Isweek_Photo; obj.Abl_Photo_Medium = objGet.Abl_Photo_Medium; obj.Abl_Photo_Origin = objGet.Abl_Photo_Origin; obj.Abl_Photo_Thumnail = objGet.Abl_Photo_Thumnail; obj.Authod_Name = objGet.Authod_Name; obj.Copy_From = objGet.Copy_From; obj.Date_Create = objGet.Date_Create; obj.OrderByPhoto = objGet.OrderByPhoto; obj.Creator = objGet.Creator; obj.File_Size = objGet.File_Size; obj.File_Type = objGet.File_Type; obj.FileSquare = objGet.FileSquare; obj.Abl_Photo_Status = objGet.Abl_Photo_Status; return(obj); }
public int InsertT_Album_Photo(HPCInfo.T_Album_Photo objAlbum_photo) { int _inserted; try { _inserted = HPCDataProvider.Instance().InsertObjectReturn(objAlbum_photo, "[CMS_InsertT_Album_Photo]"); } catch (Exception ex) { throw ex; } return(_inserted); }
private HPCInfo.T_Album_Photo setItem_Album_Photo(int AlbumID, string Abl_Photo_Name, string Abl_Photo_Desc, string File_Size, string FileSquare, string Authod_Name, string File_Type, int Lang_ID, int OrderByPhoto, string Abl_Photo_Origin) { HPCInfo.T_Album_Photo _objPoto = new HPCInfo.T_Album_Photo(); _objPoto.Alb_Photo_ID = 0; //_objPoto.Abl_Photo_Name = Abl_Photo_Name; //_objPoto.Abl_Photo_Desc = Abl_Photo_Desc; _objPoto.Abl_Photo_Origin = Abl_Photo_Origin; _objPoto.File_Size = File_Size; _objPoto.File_Type = File_Type; _objPoto.Authod_Name = ""; _objPoto.Cat_Album_ID = AlbumID; _objPoto.Lang_ID = Lang_ID; _objPoto.Abl_Isweek_Photo = false; _objPoto.Date_Create = DateTime.Now; _objPoto.Date_Modify = DateTime.Now; _objPoto.OrderByPhoto = OrderByPhoto; _objPoto.Creator = _user.UserID; _objPoto.UserModify = _user.UserID; _objPoto.Abl_Photo_Status = 1; _objPoto.Copy_From = 0; return(_objPoto); }
private HPCInfo.T_Album_Photo setItem(int PhotoID, string PhotoTitle, string PhotoDesc, int PhotoOrder, int tienNB, string tacgia, int tacgiaID) { HPCInfo.T_Album_Photo _objPoto = new HPCInfo.T_Album_Photo(); HPCBusinessLogic.DAL.T_Album_PhotoDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_PhotoDAL(); _objPoto = _cateDAL.load_T_Album_Photo(PhotoID); //_objPoto.Alb_Photo_ID = PhotoID; _objPoto.Abl_Photo_Name = PhotoTitle; _objPoto.Abl_Photo_Desc = PhotoDesc; _objPoto.OrderByPhoto = PhotoOrder; _objPoto.TongtienTT = tienNB; _objPoto.AuthorID = tacgiaID; //_objPoto.Cat_Album_ID = cat_id; //_objPoto.Date_Create = DateTime.Now; //_objPoto.Creator = _user.UserID; _objPoto.Authod_Name = tacgia; //_objPoto.Abl_Isweek_Photo = _imageAlbum; //_objPoto.Lang_ID = LangID; //_objPoto.Copy_From = 0; //_objPoto.Abl_Photo_Origin = PhotoPath; //_objPoto.Abl_Photo_Thumnail = PhotoPath; //_objPoto.Abl_Photo_Status = PhotoStatus; return(_objPoto); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Expires = -1; try { HttpPostedFile postedFile = context.Request.Files["Filedata"]; string[] sArrProdID = null; char[] sep = { '?' }; string[] sArrVkey = null; string strUserID = ""; char[] sep2 = { ',' }; sArrProdID = context.Request.QueryString["user"].ToString().Trim().Split(sep); sArrVkey = sArrProdID[0].ToString().Trim().Split(sep2); string _urlSave = ""; string FolderCat = ""; string savepath = ""; string tempPath = ""; string strRootPathVirtual = ""; _user = _userDAL.GetUserByUserName(sArrVkey[0].ToString()); strUserID = _user.UserID.ToString(); string vType = sArrVkey[1].ToString(); string AlbumID = sArrVkey[2].ToString(); if (vType == "1") { FolderCat = "/Article/"; } else if (vType == "2") { FolderCat = "/Ads/"; } else if (vType == "3") { FolderCat = "/Video/"; } else if (vType == "4") { FolderCat = "/Photo24/"; } else { FolderCat = ""; } tempPath = System.Configuration.ConfigurationManager.AppSettings["UploadPathBDT"] + FolderCat + sArrVkey[0].ToString() + "/"; strRootPathVirtual = tempPath + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/"; savepath = context.Server.MapPath(strRootPathVirtual); string filename = DateTime.Now.Millisecond.ToString() + "_" + postedFile.FileName; string _extenfile = Path.GetExtension(filename.ToString().Trim()).Replace(".", ""); if (!Directory.Exists(savepath)) { Directory.CreateDirectory(savepath); } postedFile.SaveAs(savepath + @"\" + filename); string _logo = context.Server.MapPath("../Dungchung/Images/IconHPC/LoGoDongDau.png"); string _imagesEndWatermark = DateTime.Now.ToString("yyyyMMdd").ToString() + DateTime.Now.ToString("HHmmss") + DateTime.Now.Millisecond + UltilFunc.ReplaceCharsRewrite(filename.Replace(Path.GetExtension(filename.ToString().Trim()), "")) + "." + _extenfile; _urlSave = UrlPathImage_RemoveUpload(strRootPathVirtual + _imagesEndWatermark); // Begin BO CT EDIT Đóng dấu ảnh if (Convert.ToBoolean(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["WatermarkImages"]))) { HPCImageResize.SaveImage2Server(savepath, filename, "rez_" + filename, _imagesEndWatermark, _logo, Convert.ToInt32(HPCComponents.Global.VNPResizeImages), Convert.ToInt32(HPCComponents.Global.VNPResizeImages)); } else// Không đóng dấu ảnh //END { HPCImageResize.SaveImage2Server(savepath, filename, _imagesEndWatermark, Convert.ToInt32(HPCComponents.Global.VNPResizeImages), Convert.ToInt32(HPCComponents.Global.VNPResizeImages)); } // INSERT DATABASE //phan insert co so du lieu HPCInfo.T_Album_Photo _obj = new HPCInfo.T_Album_Photo(); HPCBusinessLogic.DAL.T_Album_PhotoDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_PhotoDAL(); _obj = setItem_Album_Photo(Convert.ToInt32(AlbumID.ToString()), filename, filename, postedFile.ContentLength.ToString(), "", "", _extenfile, 1, 0, _urlSave); _cateDAL.InsertT_Album_Photo(_obj); context.Response.Write(savepath + "/" + filename); context.Response.StatusCode = 200; } catch (Exception ex) { context.Response.Write("Error: " + ex.Message); } }