private void InsertUniversityDetails() { string errMsg; var fileName = this.FlUpload.UploadedImageName; _objUniversityPropertyr = new UniversityProperty { UniversityName = txtUniversityName.Text.Trim(), UniversityTitle = txtUniversityTitle.Text.Trim(), UniversityUrl = txtUniversityUrl.Text.Trim(), UniversityWebsite = txtUniversityWebsite.Text.Trim(), UniversityshortName = txtUniversityshortName.Text.Trim(), UniversityLogo = fileName, UniversityPopularName = txtUniversityPopularName.Text.Trim(), UniversityPhoneNo = txtUniversityPhoneNo.Text.Trim(), UniversityMobile = txtUniversityMobile.Text.Trim(), UniversityMetaDesc = txtUniversityMetaDesc.Text.Trim(), UniversityFax = txtUniversityFax.Text.Trim(), UniversityEst = !string.IsNullOrEmpty(txtUniversityEstablished.Text.Trim())?Convert.ToInt32(txtUniversityEstablished.Text.Trim()):0, UniversityEmailId = txtUniversityEmailId.Text.Trim(), UniversityDesc = fckUniversityDesc.FckValue.Trim(), UniversityAddrs = txtUniversityAddrs.Text.Trim(), UniversityMetaTag = txtStreamMetaTag.Text.Trim(), UniversityCategoryId = Convert.ToInt32(hdnUniversityCategory.Value), UniversityCityId = Convert.ToInt32(hdnCity.Value), UniversityCountryId = Convert.ToInt32(hdnCountry.Value), UniversityStateId = Convert.ToInt32(hdnState.Value) }; var result = UniversityProvider.Instance.InsertUniversityDetails(_objUniversityPropertyr, LoggedInUserId, out errMsg); if (result > 0) { Response.Redirect("UniversityMaster.aspx"); } }
protected void BtnUploadClick(object sender, ImageClickEventArgs e) { _objCommon = new Common(); var objClsOledbdatalayer = new ClsOleDBDataWrapper(); var path = MapPath(fulUploadExcel.FileName); fulUploadExcel.SaveAs(path); var excelSheets = objClsOledbdatalayer.CountTotalSheets(path); if (excelSheets.Length <= 0) { return; } foreach (DataSet ds in excelSheets.Select(t => objClsOledbdatalayer.getdata(path, t)).Where(ds => ds.Tables[0].Rows.Count > 0)) { for (var j = 0; j <= ds.Tables[0].Rows.Count - 1; j++) { var errMsg = ""; _objUniversityPropertyr = new UniversityProperty { UniversityName = ds.Tables[0].Rows[j]["AjUniversityName"].ToString(), UniversityWebsite = ds.Tables[0].Rows[j]["AjUniversityWebsite"].ToString(), UniversityshortName = ds.Tables[0].Rows[j]["AjUniversityShortName"].ToString(), UniversityPopularName = ds.Tables[0].Rows[j]["AjUniversityPopularName"].ToString(), UniversityPhoneNo = ds.Tables[0].Rows[j]["AJuniversityPhone"].ToString(), UniversityMobile = ds.Tables[0].Rows[j]["AjUniversityMobile"].ToString(), UniversityFax = ds.Tables[0].Rows[j]["AjUniversityFax"].ToString(), UniversityEst = Convert.ToInt32(ds.Tables[0].Rows[j]["AjUniversityEst"].ToString()), UniversityEmailId = ds.Tables[0].Rows[j]["AjUniversityEmailId"].ToString(), UniversityDesc = ds.Tables[0].Rows[j]["AjUniversityDesc"].ToString(), UniversityAddrs = ds.Tables[0].Rows[j]["AjUniversityAddress"].ToString(), UniversityCategoryName = ds.Tables[0].Rows[j]["AjUniversityCategoryId"].ToString(), UniversityCityName = ds.Tables[0].Rows[j]["AjUniversityCityId"].ToString(), UniversityCountryName = ds.Tables[0].Rows[j]["AjUniversityCountryId"].ToString(), UniversityStateName = ds.Tables[0].Rows[j]["AjUniversityStateId"].ToString() }; var result = UniversityProvider.Instance.InsertUniversityDetailsUpload(_objUniversityPropertyr, LoggedInUserId, out errMsg); } Response.Redirect("UniversityMaster.aspx"); } }