private int AddData() { string ApplicationId = ddlApplicationList.SelectedValue; string PortalName = txtPortalName.Text; string Currency = ddlCurrencyTypeList.SelectedValue; string HostFee = txtHostFee.Text; int HostSpace = Convert.ToInt32(txtHostSpace.Text); string DefaultLanguage = ddlLanguageList.Text; string HomeDirectory = txtHomeDirectory.Text; string Url = txtUrl.Text; string KeyWords = txtKeyWords.Text; string FooterText = txtFooterText.Text; string Description = txtDescription.Text; string CreatedByUserId = Session["UserId"].ToString(); #region UPLOAD ************************************************************************************************************/ string[] array_files = new String[2]; string LogoFile = string.Empty; string BackgroundFile = string.Empty; string logo_dir_path = Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/portal_images/logo"); string background_dir_path = Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/portal_images/backgrounds"); FileHandleClass file_handle_obj = new FileHandleClass(); HttpPostedFile _logo_file = InputLogoFile.PostedFile; if (_logo_file.ContentLength > 0) { LogoFile = file_handle_obj.uploadInputFile(_logo_file, logo_dir_path); } HttpPostedFile _background_file = InputBackgroundFile.PostedFile; if (_background_file.ContentLength > 0) { BackgroundFile = file_handle_obj.uploadInputFile(_background_file, background_dir_path); } #endregion ================================================================================ #region xu ly thoi gian ===================================================================================== System.Globalization.DateTimeFormatInfo MyDateTimeFormatInfo = new System.Globalization.DateTimeFormatInfo(); MyDateTimeFormatInfo.ShortDatePattern = "dd/MM/yyyy"; string ExpiryDate = null; if (txtExpiryDate.Text != string.Empty) { DateTime _ExpiryDate = DateTime.Parse(txtExpiryDate.Text, MyDateTimeFormatInfo); ExpiryDate = _ExpiryDate.ToString("yyyy-MM-dd"); } #endregion ==================================================================================================== PortalController portal_obj = new PortalController(); int i = portal_obj.Insert(ApplicationId, PortalName, ExpiryDate, Currency, HostFee, HostSpace, DefaultLanguage, HomeDirectory, Url, LogoFile, BackgroundFile, KeyWords, FooterText, Description, CreatedByUserId); return i; }