public override int InsertCollegeSpeechDetails(CollegeSpeechProperty objCollegeSppechProperty, int createdBy, out string errmsg) { _objDataWrapper = new DbWrapper(Common.CnnString, CommandType.StoredProcedure); errmsg = ""; try { _objDataWrapper.AddParameter("@CollegeName", objCollegeSppechProperty.CollegeName); _objDataWrapper.AddParameter("@CollegeSpeechPersonDesignation", objCollegeSppechProperty.CollegeSpeechPersonDesignation); _objDataWrapper.AddParameter("@CollegeSpeechPersonName", objCollegeSppechProperty.CollegeSpeechPersonName); _objDataWrapper.AddParameter("@CollegeSpeechPersonImage", objCollegeSppechProperty.CollegeSpeechPersonImage); _objDataWrapper.AddParameter("@CollegeSpeechDesc", objCollegeSppechProperty.CollegeSpeechDesc); _objDataWrapper.AddParameter("@AboutKeyPerson", objCollegeSppechProperty.AboutKeyPerson); _objDataWrapper.AddParameter("@SpeechStatus", objCollegeSppechProperty.SpeechStatus); _objDataWrapper.AddParameter("@CreatedBy", createdBy); var errMsg = (SqlParameter)(_objDataWrapper.AddParameter("@ErrMsg", "", SqlDbType.VarChar, ParameterDirection.Output, 128)); _i = _objDataWrapper.ExecuteNonQuery("Aj_Proc_InsertUpdateCollegeSpeechDetails"); if (errMsg != null && errMsg.Value != null) { errmsg = Convert.ToString(errMsg.Value); } } catch (Exception ex) { var err = ex.Message; if (ex.InnerException != null) { err = err + " :: Inner Exception :- " + ex.ToString(); } const string addInfo = "Error while executing InsertCollegeSpeechDetails in CollegeSpeech.cs :: -> "; var objPub = new ClsExceptionPublisher(); objPub.Publish(err, addInfo); } return(_i); }
// Private Method to Bind the College Group Object Details private List <CollegeSpeechProperty> BindCollegeSpeechObjectList(DataTable datatable) { var objCollegeSpeechList = new List <CollegeSpeechProperty>(); try { if (datatable.Rows.Count > 0) { for (var j = 0; j < datatable.Rows.Count; j++) { var objCollegeSpeechProperty = new CollegeSpeechProperty { CollegeSpeechId = (datatable.Rows[j]["AjCollegeKeySpeechId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[j]["AjCollegeKeySpeechId"]), CollegeName = (datatable.Rows[j]["AjCollegeBranchName"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjCollegeBranchName"]), CollegeBranhID = (datatable.Rows[j]["AjCollegeBranchId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[j]["AjCollegeBranchId"]), CollegeSpeechPersonName = (datatable.Rows[j]["AjCollegeKeySpeechPersonName"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjCollegeKeySpeechPersonName"]), CollegeSpeechPersonDesignation = (datatable.Rows[j]["AjCollegeKeySpeechPersonDesignation"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjCollegeKeySpeechPersonDesignation"]), CollegeSpeechPersonImage = (datatable.Rows[j]["AjCollegeKeySpeechPersonImage"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjCollegeKeySpeechPersonImage"]), CollegeSpeechDesc = (datatable.Rows[j]["AjCollegeKeySpeechDesc"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjCollegeKeySpeechDesc"]), AboutKeyPerson = (datatable.Rows[j]["AjAboutKeyPerson"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjAboutKeyPerson"]), SpeechStatus = (datatable.Rows[j]["AjAboutKeySpeechStatus"] is DBNull) ? true : Convert.ToBoolean(datatable.Rows[j]["AjAboutKeySpeechStatus"]), }; objCollegeSpeechList.Add(objCollegeSpeechProperty); } } } catch (Exception ex) { var err = ex.Message; if (ex.InnerException != null) { err = err + " :: Inner Exception :- " + ex.ToString(); } const string addInfo = "Error while executing BindCollegeGroupObjectList in College.cs :: -> "; var objPub = new ClsExceptionPublisher(); objPub.Publish(err, addInfo); } return(objCollegeSpeechList); }
public abstract int UpdateCollegeSpeechDetails(CollegeSpeechProperty objCollegeSpeechProperty, int modifiedBy, out string errmsg);
protected void btnSubmit_Click(object sender, EventArgs e) { if (uploadFile.HasFile) { var fileName = Server.MapPath(new Common().GetFilepath("UniversityImage") + uploadFile.FileName); var fileextension = System.IO.Path.GetExtension(fileName); if (fileextension != null) { var index = fileName.LastIndexOf(fileextension, System.StringComparison.Ordinal); fileName = fileName.Substring(0, index); var newfname = fileName; index = 0; while (System.IO.File.Exists(newfname + fileextension)) { newfname = fileName + index++; } uploadFile.SaveAs(newfname + fileextension); hdnFileName.Value = System.IO.Path.GetFileName(newfname + fileextension); } } try { var objCollegeSpeech = new CollegeSpeechProperty { CollegeName = Convert.ToString(txtSelectCollegeFiltered.Text.Trim()), CollegeSpeechPersonDesignation = Convert.ToString( txtPersonDesignation.Text.Trim()), CollegeSpeechPersonName = Convert.ToString( txtSpeechPersonName.Text.Trim()), AboutKeyPerson = Convert.ToString(txtAbouKeyPerson.Text.Trim()), CollegeSpeechDesc = Convert.ToString(txtDescription.FckValue.Trim()), CollegeSpeechPersonImage = hdnFileName.Value, SpeechStatus = chkStatus.Checked }; var errorMsg = ""; var insert = 0; if (btnSubmit.Text == "Insert") { insert = CollegeSpeechProvider.Instance.InsertCollegeSpeechDetails(objCollegeSpeech, LoggedInUserId, out errorMsg); } else { objCollegeSpeech.CollegeSpeechId = Convert.ToInt32(ViewState["CollegePresedentId"]); insert = CollegeSpeechProvider.Instance.UpdateCollegeSpeechDetails(objCollegeSpeech, LoggedInUserId, out errorMsg); btnSubmit.Text = "Insert"; } ClearFields(); lblSeccessMsg.Visible = true; lblSeccessMsg.Text = errorMsg; lblSeccessMsg.CssClass = insert > 0 ? "success" : "info"; BindSponserCollegeDetails(); } catch (Exception ex) { string err = ex.Message; if (ex.InnerException != null) { err = err + " :: Inner Exception :- " + ex.InnerException.Message; } const string addInfo = "Error in Executing btnSubmit_Click in PresidentSpeech.aspx :: -> "; var objPub = new ClsExceptionPublisher(); objPub.Publish(err, addInfo); } }
public abstract int InsertCollegeSpeechDetails(CollegeSpeechProperty objCollegeSpeechProperty, int createdBy, out string errmsg);