protected void grdItemMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("ADD")) { DropDownList ddlNewCanteenName = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCanteenName"); DropDownList ddlNewCategoryGroupCode = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCategoryGroupCode"); DropDownList ddlNewCategoryItemCode = (DropDownList)grdItemMaster.FooterRow.FindControl("ddlNewCategoryItemCode"); TextBox txtNewItemName = (TextBox)grdItemMaster.FooterRow.FindControl("txtNewItemName"); TextBox txtNewItemEmployeeRate = (TextBox)grdItemMaster.FooterRow.FindControl("txtNewItemEmployeeRate"); CheckBox ChStatusNew = (CheckBox)grdItemMaster.FooterRow.FindControl("ChStatusNew"); if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_ItemMaster = new ML_ItemMaster(); objML_ItemMaster.CanteenCode = Convert.ToInt32(ML_Common.clean(ddlNewCanteenName.SelectedValue)); objML_ItemMaster.CategoryGroupCode = Convert.ToInt32(ML_Common.clean(ddlNewCategoryGroupCode.SelectedValue)); objML_ItemMaster.ItemCategoryCode = Convert.ToInt32(ML_Common.clean(ddlNewCategoryItemCode.SelectedValue)); objML_ItemMaster.ItemName = ML_Common.clean(txtNewItemName.Text); objML_ItemMaster.ItemEmployeeRate = Convert.ToDecimal(ML_Common.clean(txtNewItemEmployeeRate.Text)); if (ChStatusNew.Checked) { objML_ItemMaster.ItemActive = 1; } else { objML_ItemMaster.ItemActive = 0; } int obhReturn = objBusinessClass.AddItemMaster(objML_ItemMaster); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; FillGrid(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { // LogManager.LogManager.WriteErrorLog(sqlExc); SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } } }
protected void grdCanteenMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("ADD")) { TextBox txtNewCanteenTypeName = (TextBox)grdCanteenMaster.FooterRow.FindControl("txtNewCanteenTypeName"); CheckBox txtNewRemarks = (CheckBox)grdCanteenMaster.FooterRow.FindControl("txtNewRemarks"); if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeType = new ML_CokeType(); objML_CokeType.CokeType = ML_Common.clean(txtNewCanteenTypeName.Text); objML_CokeType.Remarks = ML_Common.clean(txtNewRemarks.Text); objML_CokeType.IsActive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeType.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeType.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeType.CreatedBy = Session["UserName"].ToString(); objML_CokeType.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeType.ModifiedBy = ML_Common.clean(string.Empty); int obhReturn = objBusinessClass.AddCokeType(objML_CokeType); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; FillGrid(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { // LogManager.LogManager.WriteErrorLog(sqlExc); SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } } }
protected void grdCanteenMaster_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox txtCanteenTypeNameEdit = (TextBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtCanteenTypeNameEdit"); //TextBox txtRemarksEdit = (TextBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtRemarksEdit"); CheckBox txtRemarksEdit = (CheckBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtRemarksEdit"); if (IsValid) { //errNumber = -1; BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = ML_Common.string2int(grdCanteenMaster.DataKeys[e.RowIndex].Values[0].ToString()); ML_CokeType objML_CokeType = objBusinessClass.GetCokeTypeById(lngId); try { if (objML_CokeType != null) { objML_CokeType.CokeType = ML_Common.clean(txtCanteenTypeNameEdit.Text); objML_CokeType.Remarks = ML_Common.clean(txtRemarksEdit.Text); int obhReturn = objBusinessClass.UpdateCokeType(objML_CokeType); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Update Successfully"; } else if (obhReturn == 2) { lblMsg.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } grdCanteenMaster.EditIndex = -1; FillGrid(); } } catch (SqlException sqlExc) { SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
public ML_CokeType GetCokeTypeByCokeTypeId(int CokeTypeId) { DataTable dt = new DataTable(); try { objML_CokeType = new ML_CokeType(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@CokeTypeId", CokeTypeId) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeTypeByCokeTypeId.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; objML_CokeType.Id = ML_Common.string2int32(ML_Common.clean(dr["Id"].ToString())); objML_CokeType.CokeTypeId = ML_Common.string2int32(ML_Common.clean(dr["CokeTypeId"].ToString())); objML_CokeType.CokeType = ML_Common.clean(dr["CokeType"].ToString()); objML_CokeType.Remarks = ML_Common.clean(dr["Remarks"].ToString()); objML_CokeType.IsActive = ML_Common.clean(dr["IsActive"].ToString()); objML_CokeType.IsArchive = ML_Common.clean(dr["IsArchive"].ToString()); objML_CokeType.CreatedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString())); objML_CokeType.CreatedBy = ML_Common.clean(dr["CreatedBy"].ToString()); objML_CokeType.ModifiedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString())); objML_CokeType.ModifiedBy = ML_Common.clean(dr["ModifiedBy"].ToString()); objML_CokeType.CreatedByUserNameId = ML_Common.string2int(ML_Common.clean(dr["CreatedByUserNameId"].ToString())); } } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog( } return(objML_CokeType); }
public ML_UserType GetUserTypeByUserType(string UserType) { DataTable dt = new DataTable(); try { objML_UserType = new ML_UserType(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@UserType", UserType) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetUserTypeByUserType.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; objML_UserType.Id = ML_Common.string2Int32(ML_Common.clean(dr["Id"].ToString())); objML_UserType.UserTypeId = ML_Common.string2Int32(ML_Common.clean(dr["UserTypeId"].ToString())); objML_UserType.UserType = ML_Common.clean(dr["UserType"].ToString()); objML_UserType.IsActive = ML_Common.clean(dr["IsActive"].ToString()); objML_UserType.IsArchive = ML_Common.clean(dr["IsArchive"].ToString()); objML_UserType.CreatedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString())); objML_UserType.CreatedBy = ML_Common.clean(dr["CreatedBy"].ToString()); objML_UserType.ModifiedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString())); objML_UserType.ModifiedBy = ML_Common.clean(dr["ModifiedBy"].ToString()); objML_UserType.CreatedByUserNameId = ML_Common.string2Int32(dr["CreatedByUserNameId"].ToString()); } } } catch (Exception ex) { Exception exx = ex; throw; } finally { // } return(objML_UserType); }
private void FillGrid() { try { DataTable DtList = null; if (ViewState["grdCokeSupplier"] == null) { ML_CokeSupplier objML_CokeSupplierh = new ML_CokeSupplier(); objML_CokeSupplierh.CokeSupplier = ML_Common.clean(txtCokeSupplierSearch.Text); objBusinessClass = new BusinessLayer.BusinessClass(); DtList = objBusinessClass.GetCokeSupplierBySeacrh(objML_CokeSupplierh); ViewState["grdCokeSupplier"] = DtList; } else { DtList = (DataTable)ViewState["grdCokeSupplier"]; } if (DtList != null) { // DtList = (DataTable)ViewState["grdPitchType"]; if (DtList.Rows.Count > 0) { grdCokeSupplier.DataSource = DtList; grdCokeSupplier.DataBind(); } else { DtList.Rows.Add(DtList.NewRow()); grdCokeSupplier.DataSource = DtList; grdCokeSupplier.DataBind(); int TotalColumns = grdCokeSupplier.Rows[0].Cells.Count; grdCokeSupplier.Rows[0].Cells.Clear(); grdCokeSupplier.Rows[0].Cells.Add(new TableCell()); grdCokeSupplier.Rows[0].Cells[0].ColumnSpan = TotalColumns; grdCokeSupplier.Rows[0].Cells[0].Text = "No Record Found"; } UpdatePanelGrid.Update(); } } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } }
public ML_CanteenMaster GetCanteenMasterByCanteenActive(long CanteenActive) { try { sbTraceInformation = new StringBuilder(); sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:GetCanteenMasterById(long Id)"); sbTraceInformation.Remove(0, sbTraceInformation.Length); objML_CanteenMaster = new ML_CanteenMaster(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@CanteenActive", CanteenActive) #endregion }; this.Parameters = parameters; DataSet ds = SqlHelper.ExecuteDataset(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCanteenMasterByCanteenActive.ToString(), this.Parameters); sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:GetCanteenMasterById(long Id)"); sbTraceInformation.Remove(0, sbTraceInformation.Length); if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; objML_CanteenMaster.CanteenCode = ML_Common.string2int32(ML_Common.clean(dr["CanteenCode"].ToString())); objML_CanteenMaster.CanteenName = ML_Common.clean(dr["CanteenName"].ToString()); objML_CanteenMaster.CanteenAddress = ML_Common.clean(dr["CanteenAddress"].ToString()); objML_CanteenMaster.CanteenActive = ML_Common.string2int32(ML_Common.clean(dr["CanteenActive"].ToString())); } } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString()); } return(objML_CanteenMaster); }
protected void btnChangePassword_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_UserName = new ML_UserName(); string UserName = ML_Common.clean(txtUserName.Text); string oldPassword = ML_Common.clean(txtOldPassword.Text); string newPassword = ML_Common.clean(txtNewPassword.Text); int obhReturn = objBusinessClass.UpdatePassword(UserName, oldPassword, newPassword); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Password changed Successfully"; } else if (obhReturn == 2) { lblMsg.Text = "User Name/Password is not Correct!"; lblMsg.Visible = true; } else { lblMsg.Text = "There are some issue while Updating, Please enter correct old Password!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exx = ex; } } }
private void FillObjectToForm(int lngId, bool IsEditFlag = true) { objBusinessClass = new BusinessLayer.BusinessClass(); ML_UserName objML_UserName = objBusinessClass.GetUserNameById(lngId); try { if (objML_UserName != null) { if (IsEditFlag) { txtUserNameEdit.Text = ML_Common.clean(objML_UserName.UserName); txtFirstNameEdit.Text = ML_Common.clean(objML_UserName.FirstName); txtLastNameEdit.Text = ML_Common.clean(objML_UserName.LastName); txtEmailEdit.Text = ML_Common.clean(objML_UserName.Email); txtMobileEdit.Text = ML_Common.clean(objML_UserName.Mobile); lblUserType.Text = ML_Common.clean(objML_UserName.UserType); } else { lblUserName.Text = ML_Common.clean(objML_UserName.UserName); lblFirstName.Text = ML_Common.clean(objML_UserName.FirstName); lblLastName.Text = ML_Common.clean(objML_UserName.LastName); lblEmail.Text = ML_Common.clean(objML_UserName.Email); lblMobile.Text = ML_Common.clean(objML_UserName.Mobile); lblUserType.Text = ML_Common.clean(objML_UserName.UserType); } } } catch (Exception ex) { Exception exx = ex; } }
protected void btnAdd_Click(object sender, EventArgs e) { try { if (btnAdd.Enabled) { DataRow dr; if (ViewState["dtCokeDynamic"] == null) { dtCokeDynamic = new DataTable(); dtCokeDynamic = BindCokeDynamicDataTable(); } else { dtCokeDynamic = (DataTable)ViewState["dtCokeDynamic"]; } dr = dtCokeDynamic.NewRow(); dr["CokeTypeId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true)); dr["CokeType"] = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false)); dr["CokeSupplierId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplier, true)); dr["CokeSupplier"] = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplier, false)); //dr["NameofParty"] = dr["CokeSupplier"]; dr["AnalysisTypeId"] = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true)); dr["AnalysisType"] = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false)); //dr["NameofAnalysis"] = dr["AnalysisType"]; //dr["SampleNo"] = dtFlowMetrDataTable.Rows.Count + 1;// ML_Common.string2int32(ML_Common.clean(txtSampleNo.Text)); //dr["SamplingDate"] = ML_Common.ToDateTimeSafeNull(txtSamplingDate.Text); //dr["StoreSINo"] = ML_Common.string2int32(ML_Common.clean(txtStoreSINo.Text)); //dr["SampleDetail"] = ML_Common.clean(txtSampleDetail.Text); dr["FieldSize"] = ML_Common.clean(txtFieldSize.Text); dr["FieldUnit"] = ML_Common.clean(txtFieldUnit.Text); dr["FieldSpec"] = ML_Common.clean(txtFieldSpec.Text); dr["MinValue"] = ML_Common.clean(txtMinValue.Text); dr["MaxValue"] = ML_Common.clean(txtMaxValue.Text); dtCokeDynamic.Rows.Add(dr); //DtList = (DataTable)ViewState["grdStartupBathTapping"]; if (dtCokeDynamic.Rows.Count > 0) { ViewState["dtCokeDynamic"] = dtCokeDynamic; grdCokeDynamic.DataSource = dtCokeDynamic; grdCokeDynamic.DataBind(); } else { dtCokeDynamic.Rows.Add(dtCokeDynamic.NewRow()); grdCokeDynamic.DataSource = dtCokeDynamic; grdCokeDynamic.DataBind(); int TotalColumns = grdCokeDynamic.Rows[0].Cells.Count; grdCokeDynamic.Rows[0].Cells.Clear(); grdCokeDynamic.Rows[0].Cells.Add(new TableCell()); grdCokeDynamic.Rows[0].Cells[0].ColumnSpan = TotalColumns; grdCokeDynamic.Rows[0].Cells[0].Text = "No Record Found"; } txtFieldSize.Text = string.Empty; txtFieldUnit.Text = string.Empty; txtFieldSpec.Text = string.Empty; txtMinValue.Text = string.Empty; txtMaxValue.Text = string.Empty; UpdatePanelGrid.Update(); btnSubmit.Visible = true; btnSubmit.BackColor = System.Drawing.ColorTranslator.FromHtml("#5bc0de"); btnSubmit.ForeColor = System.Drawing.Color.White; btnNewAdd.Visible = true; // btnNewAdd.BackColor = System.Drawing.Color.Green; btnNewAdd.BackColor = System.Drawing.ColorTranslator.FromHtml("#5bc0de"); btnSubmit.ForeColor = System.Drawing.Color.White; UpdatePanelSave.Update(); } } catch (Exception ex) { string str = ex.Message.ToString(); } }
public ML_CokeSupplier GetCokeSupplierByCokeSupplierId(int CokeSupplierId) { DataTable dt = new DataTable(); try { objML_CokeSupplier = new ML_CokeSupplier(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@CokeSupplierId", CokeSupplierId) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeSupplierByCokeSupplierId.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; objML_CokeSupplier.Id = ML_Common.string2int32(ML_Common.clean(dr["Id"].ToString())); objML_CokeSupplier.CokeSupplierId = ML_Common.string2int32(ML_Common.clean(dr["CokeSupplierId"].ToString())); objML_CokeSupplier.CokeSupplier = ML_Common.clean(dr["CokeSupplier"].ToString()); objML_CokeSupplier.Address1 = ML_Common.clean(dr["Address1"].ToString()); objML_CokeSupplier.Address2 = ML_Common.clean(dr["Address2"].ToString()); objML_CokeSupplier.Address3 = ML_Common.clean(dr["Address3"].ToString()); objML_CokeSupplier.CityName = ML_Common.clean(dr["CityName"].ToString()); objML_CokeSupplier.StateName = ML_Common.clean(dr["StateName"].ToString()); objML_CokeSupplier.PinCode = ML_Common.clean(dr["PinCode"].ToString()); objML_CokeSupplier.Title = ML_Common.clean(dr["Title"].ToString()); objML_CokeSupplier.CountryName = ML_Common.clean(dr["CountryName"].ToString()); objML_CokeSupplier.ContactPerson = ML_Common.clean(dr["ContactPerson"].ToString()); objML_CokeSupplier.MobNo = ML_Common.clean(dr["MobNo"].ToString()); objML_CokeSupplier.WebSite = ML_Common.clean(dr["WebSite"].ToString()); objML_CokeSupplier.Email = ML_Common.clean(dr["Email"].ToString()); objML_CokeSupplier.Remarks = ML_Common.clean(dr["Remarks"].ToString()); objML_CokeSupplier.IsActive = ML_Common.clean(dr["IsActive"].ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(dr["IsArchive"].ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString())); objML_CokeSupplier.CreatedBy = ML_Common.clean(dr["CreatedBy"].ToString()); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString())); objML_CokeSupplier.ModifiedBy = ML_Common.clean(dr["ModifiedBy"].ToString()); objML_CokeSupplier.CreatedByUserNameId = ML_Common.string2int(ML_Common.clean(dr["CreatedByUserNameId"].ToString())); } } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog( } return(objML_CokeSupplier); }
protected void btnUpdate_Click(object sender, EventArgs e) { lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; if (IsValid) { //errNumber = -1; BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = Convert.ToInt32(ViewState["grdCokeSupplierId"]); ML_CokeSupplier objML_CokeSupplier = objBusinessClass.GetCokeSupplierById(lngId); try { if (objML_CokeSupplier != null) { // objML_CokeSupplier.Id = ML_Common.string2int32(ML_Common.clean(txtIdEdit.Text)); // objML_CokeSupplier.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierEdit, true)); objML_CokeSupplier.CokeSupplier = ML_Common.string2string(txtCokeSupplierEdit.Text); objML_CokeSupplier.Address1 = ML_Common.clean(txtAddress1Edit.Text); objML_CokeSupplier.Address2 = ML_Common.clean(txtAddress2Edit.Text); objML_CokeSupplier.Address3 = ML_Common.clean(txtAddress3Edit.Text); objML_CokeSupplier.CityName = string.Empty; //ML_Common.clean(txtCityNameEdit.Text); objML_CokeSupplier.StateName = string.Empty; // ML_Common.clean(txtStateNameEdit.Text); objML_CokeSupplier.PinCode = string.Empty; //ML_Common.clean(txtPinCodeEdit.Text); objML_CokeSupplier.Title = string.Empty; // ML_Common.clean(txtTitleEdit.Text); objML_CokeSupplier.CountryName = string.Empty; // ML_Common.clean(txtCountryNameEdit.Text); objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPersonEdit.Text); objML_CokeSupplier.MobNo = ML_Common.clean(txtMobNoEdit.Text); objML_CokeSupplier.WebSite = string.Empty;// ML_Common.clean(txtWebSiteEdit.Text); objML_CokeSupplier.Email = ML_Common.clean(txtEmailEdit.Text); objML_CokeSupplier.Remarks = ML_Common.clean(txtRemarksEdit.Text); objML_CokeSupplier.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.CreatedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.ModifiedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameIdEdit.Text)); // int obhReturn = objBusinessClass.UpdateUniqueCokeSupplier(objML_CokeSupplier); int obhReturn = objBusinessClass.UpdateCokeSupplier(objML_CokeSupplier); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; ModalPopupExtenderEdit.Hide(); lblMsgEdit.Text = string.Empty; } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsgEdit.Text = "Record Already Exists!"; lblMsg.Visible = true; ModalPopupExtenderEdit.Hide(); } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsgEdit.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } FillGrid(); } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { if (btnSubmit.Enabled) { int obhReturn = -1; objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeDynamic = new ML_CokeDynamic(); //objML_CokeDynamic.Id = ML_Common.string2Long(ML_Common.clean(txtId.Text)); //objML_CokeDynamic.CokeDynamicId = ML_Common.string2Long(ML_Common.clean(txtCokeDynamicId.Text)); //objML_CokeDynamic.CokeDynamic = ML_Common.clean(txtCokeDynamic.Text); objML_CokeDynamic.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true)); objML_CokeDynamic.CokeType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false)); objML_CokeDynamic.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplier, true)); objML_CokeDynamic.CokeSupplier = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplier, false)); objML_CokeDynamic.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true)); objML_CokeDynamic.AnalysisType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false)); objML_CokeDynamic.FieldSize = ML_Common.clean(txtFieldSize.Text); objML_CokeDynamic.FieldUnit = ML_Common.clean(txtFieldUnit.Text); objML_CokeDynamic.FieldSpec = ML_Common.clean(txtFieldSpec.Text); objML_CokeDynamic.MinValue = ML_Common.clean(txtMinValue.Text); objML_CokeDynamic.MaxValue = ML_Common.clean(txtMaxValue.Text); for (int i = 0; i <= grdCokeDynamic.Rows.Count - 1; i++) { objML_CokeDynamic.FieldSize = string.Empty; objML_CokeDynamic.FieldUnit = string.Empty; objML_CokeDynamic.FieldSpec = string.Empty; objML_CokeDynamic.MinValue = string.Empty; objML_CokeDynamic.MaxValue = string.Empty; GridViewRow gRow = grdCokeDynamic.Rows[i]; Label lblCokeTypeID = (Label)gRow.FindControl("lblCokeTypeID"); if (lblCokeTypeID != null) { objML_CokeDynamic.CokeTypeId = ML_Common.string2int32(lblCokeTypeID.Text); } Label lblCokeType = (Label)gRow.FindControl("lblCokeType"); if (lblCokeType != null) { objML_CokeDynamic.CokeType = ML_Common.clean(lblCokeType.Text); } Label lblCokeSupplierID = (Label)gRow.FindControl("lblCokeSupplierID"); if (lblCokeSupplierID != null) { objML_CokeDynamic.CokeSupplierId = ML_Common.string2int32(lblCokeSupplierID.Text); } Label lblCokeSupplier = (Label)gRow.FindControl("lblCokeSupplier"); if (lblCokeSupplier != null) { objML_CokeDynamic.CokeSupplier = ML_Common.clean(lblCokeSupplier.Text); } Label lblAnalysisTypeID = (Label)gRow.FindControl("lblAnalysisTypeID"); if (lblAnalysisTypeID != null) { objML_CokeDynamic.AnalysisTypeId = ML_Common.string2int32(lblAnalysisTypeID.Text); } Label lblAnalysisType = (Label)gRow.FindControl("lblAnalysisType"); if (lblAnalysisTypeID != null) { objML_CokeDynamic.AnalysisType = ML_Common.clean(lblAnalysisType.Text); } Label lblFieldSize = (Label)gRow.FindControl("lblFieldSize"); if (lblFieldSize != null) { objML_CokeDynamic.FieldSize = lblFieldSize.Text; } Label lblFieldUnit = (Label)gRow.FindControl("lblFieldUnit"); if (lblFieldUnit != null) { objML_CokeDynamic.FieldUnit = lblFieldUnit.Text; } Label lblFieldSpec = (Label)gRow.FindControl("lblFieldSpec"); if (lblFieldSpec != null) { objML_CokeDynamic.FieldSpec = lblFieldSpec.Text; } Label lblMinValue = (Label)gRow.FindControl("lblMinValue"); if (lblMinValue != null) { objML_CokeDynamic.MinValue = lblMinValue.Text; } Label lblMaxValue = (Label)gRow.FindControl("lblMaxValue"); if (lblMaxValue != null) { objML_CokeDynamic.MaxValue = lblMaxValue.Text; } obhReturn = objBusinessClass.AddCokeDynamic(objML_CokeDynamic); } if (obhReturn == 1) { lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; btnSubmit.Visible = false; UpdatePanelSave.Update(); } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsgEdit.Text = "Ooops!OtherIssue..."; } txtFieldSize.Text = string.Empty; txtFieldUnit.Text = string.Empty; txtFieldSpec.Text = string.Empty; txtMinValue.Text = string.Empty; txtMaxValue.Text = string.Empty; lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; UpdatePanelSave.Update(); btnSubmit.Enabled = true; ViewState["dtCokeDynamic"] = null; dtCokeDynamic = new DataTable(); dtCokeDynamic = BindCokeDynamicDataTable(); grdCokeDynamic.DataSource = dtCokeDynamic; grdCokeDynamic.DataBind(); UpdatePanelGrid.Update(); btnAdd.Enabled = true; //btnSubmit.Visible = false; } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid) { errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_CategoryGroupMaster = new ML_CategoryGroupMaster(); string strAdminLoginName = string.Empty; if (Session["AdminLoginName"] != null) { strAdminLoginName = Session["AdminLoginName"].ToString(); } // objML_CategoryGroupMaster.CategoryGroupCode = ML_Common.string2int32(ML_Common.clean(txtCategoryGroupCode.Text)); objML_CategoryGroupMaster.CanteenCode = ML_Common.string2int32(ML_Common.clean(txtCanteenCode.Text)); objML_CategoryGroupMaster.CategoryGroupName = ML_Common.clean(txtCategoryGroupName.Text); // objML_CategoryGroupMaster.CategoryGroupActive = ML_Common.string2int32(ML_Common.clean(txtCategoryGroupActive.Text)); // objML_CategoryGroupMaster.IsActive = ML_Common.clean(ML_Common.bit2int(chkIsActive.Checked).ToString()); // objML_CategoryGroupMaster.IsArchive = ML_Common.clean(ML_Common.bit2int(chkIsArchive.Checked).ToString()); // objML_CategoryGroupMaster.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); // objML_CategoryGroupMaster.CreatedBy = ML_Common.clean(string.Empty); // objML_CategoryGroupMaster.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); // objML_CategoryGroupMaster.ModifiedBy = ML_Common.clean(string.Empty); int obhReturn = objBusinessClass.AddCategoryGroupMaster(objML_CategoryGroupMaster); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { // LogManager.LogManager.WriteErrorLog(sqlExc); foreach (SqlError error in sqlExc.Errors) { errNumber = error.Number; } if (errNumber == 50000) { } return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_UserName = new ML_UserName(); objML_UserName.UserName = ML_Common.clean(txtUserName.Text); objML_UserName.FirstName = ML_Common.clean(txtFirstName.Text); objML_UserName.LastName = ML_Common.clean(txtLastName.Text); objML_UserName.Email = ML_Common.clean(txtEmail.Text); objML_UserName.Telephone = ML_Common.clean(txtTelephone.Text); objML_UserName.Mobile = ML_Common.clean(txtMobile.Text); objML_UserName.Password = ML_Common.clean(txtPassword.Text); objML_UserName.UserTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlUserType, true)); objML_UserName.UserType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlUserType, false)); objML_UserName.ReTryAttempt = 3; // ML_Common.string2int32(ML_Common.clean(txtReTryAttempt.Text)); objML_UserName.IsLocked = false; // ML_Common.string2Boolean(ML_Common.clean(txtIsLocked.Text)); objML_UserName.LockedDateTime = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_UserName.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_UserName.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); if (Session["UserName"] != null && Session["UserNameId"] != null) { objML_UserName.CreatedBy = ML_Common.clean(Session["UserName"]); objML_UserName.ModifiedBy = ML_Common.clean(Session["UserName"]); objML_UserName.CreatedByUserNameId = ML_Common.string2int32(ML_Common.clean(Session["UserNameId"])); } int obhReturn = objBusinessClass.AddUserName(objML_UserName); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; FormFieldsClear(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exx = ex; } } }
protected void grdItemCategoryMaster_RowUpdating(object sender, GridViewUpdateEventArgs e) { DropDownList ddlNewCategoryGroupCode = (DropDownList)grdItemCategoryMaster.Rows[e.RowIndex].FindControl("ddlNewCategoryGroupCode"); DropDownList ddlNewCanteenName = (DropDownList)grdItemCategoryMaster.Rows[e.RowIndex].FindControl("ddlNewCanteenName"); TextBox txtNewItemCategoryName = (TextBox)grdItemCategoryMaster.Rows[e.RowIndex].FindControl("txtNewItemCategoryName"); CheckBox ChStatusNew = (CheckBox)grdItemCategoryMaster.Rows[e.RowIndex].FindControl("ChStatusNew"); DropDownList ddlNewStartTime = (DropDownList)grdItemCategoryMaster.Rows[e.RowIndex].FindControl("ddlNewStartTime"); DropDownList ddlNewEndTime = (DropDownList)grdItemCategoryMaster.Rows[e.RowIndex].FindControl("ddlNewEndTime"); if (IsValid) { //errNumber = -1; BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = ML_Common.string2int(grdItemCategoryMaster.DataKeys[e.RowIndex].Values[0].ToString()); ML_ItemCategoryMaster objML_ItemCategoryMaster = objBusinessClass.GetItemCategoryMasterByItemCategoryCode(lngId); try { if (objML_ItemCategoryMaster != null) { objML_ItemCategoryMaster.CategoryGroupCode = Convert.ToInt32(ML_Common.clean(ddlNewCategoryGroupCode.SelectedValue)); objML_ItemCategoryMaster.CanteenCode = Convert.ToInt32(ML_Common.clean(ddlNewCanteenName.SelectedValue)); objML_ItemCategoryMaster.ItemCategoryName = ML_Common.clean(txtNewItemCategoryName.Text); objML_ItemCategoryMaster.StartTime = Convert.ToDateTime(ML_Common.clean(ddlNewStartTime.SelectedValue)); objML_ItemCategoryMaster.EndTime = Convert.ToDateTime(ML_Common.clean(ddlNewEndTime.Text)); if (ChStatusNew.Checked) { objML_ItemCategoryMaster.ItemCategoryActive = 1; } else { objML_ItemCategoryMaster.ItemCategoryActive = 0; } int obhReturn = objBusinessClass.UpdateItemCategoryMaster(objML_ItemCategoryMaster); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Update Successfully"; } else if (obhReturn == 2) { lblMsg.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } grdItemCategoryMaster.EditIndex = -1; FillGrid(); } } catch (SqlException sqlExc) { SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeDynamicResult = new ML_CokeDynamicResult(); ML_CokeDynamic objML_CokeDynamic = null;// new ML_KeysPointChk(); objBusinessClass = new BusinessClass(); int CokeDynamicId = -1; int obhReturn = 0; DateTime dtDateandTime = System.DateTime.Now; if (ddlCokeType.SelectedIndex > 0) { foreach (GridViewRow row in grdCokeDynamicResult.Rows) { objML_CokeDynamic = new ML_CokeDynamic(); string txtCokeDynamicResult = string.Empty; TextBox mytxtCokeDynamicResult = (TextBox)row.FindControl("txtCokeDynamicResult"); if (mytxtCokeDynamicResult != null) { txtCokeDynamicResult = mytxtCokeDynamicResult.Text; } Label lblCokeDynamicId = (Label)row.FindControl("lblCokeDynamicId"); if (lblCokeDynamicId != null) { CokeDynamicId = ML_Common.string2int(lblCokeDynamicId.Text); objML_CokeDynamic = objBusinessClass.GetCokeDynamicByCokeDynamicId(CokeDynamicId); objML_CokeDynamicResult = new ML_CokeDynamicResult(); objML_CokeDynamicResult.CokeDynamicResult = objML_CokeDynamic.CokeDynamic; objML_CokeDynamicResult.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true)); objML_CokeDynamicResult.CokeType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false)); objML_CokeDynamicResult.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierName, true)); objML_CokeDynamicResult.CokeSupplier = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplierName, false)); objML_CokeDynamicResult.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true)); objML_CokeDynamicResult.AnalysisType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false)); objML_CokeDynamicResult.CokeDynamicId = objML_CokeDynamicResult.CokeDynamicId; objML_CokeDynamicResult.CokeDynamic = objML_CokeDynamic.CokeDynamic; objML_CokeDynamicResult.FieldSize = objML_CokeDynamic.FieldSize; objML_CokeDynamicResult.FieldUnit = objML_CokeDynamic.FieldUnit; objML_CokeDynamicResult.FieldSpec = objML_CokeDynamic.FieldSpec; objML_CokeDynamicResult.MinValue = objML_CokeDynamic.MinValue; objML_CokeDynamicResult.MaxValue = objML_CokeDynamic.MaxValue; //objML_CokeDynamicResult.CokeDynamicId = ML_Common.string2string(txtCokeDynamicResult); objML_CokeDynamicResult.CokeTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeType, true)); objML_CokeDynamicResult.CokeType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeType, false)); objML_CokeDynamicResult.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierName, true)); objML_CokeDynamicResult.CokeSupplier = ML_Common.string2string(ML_Common.GetDropDownValue(ddlCokeSupplierName, false)); objML_CokeDynamicResult.AnalysisTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlAnalysisType, true)); objML_CokeDynamicResult.AnalysisType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlAnalysisType, false)); objML_CokeDynamicResult.FieldSize = ML_Common.clean(objML_CokeDynamicResult.FieldSize); objML_CokeDynamicResult.FieldUnit = ML_Common.clean(objML_CokeDynamicResult.FieldUnit); objML_CokeDynamicResult.FieldSpec = ML_Common.clean(objML_CokeDynamicResult.FieldSpec); objML_CokeDynamicResult.MinValue = ML_Common.clean(objML_CokeDynamicResult.MinValue); objML_CokeDynamicResult.MaxValue = ML_Common.clean(objML_CokeDynamicResult.MaxValue); obhReturn = objBusinessClass.AddCokeDynamicResult(objML_CokeDynamicResult); } } if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; } FormFieldsClear(); } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } //if (IsValid ) //{ // //errNumber = -1; // try // { // objBusinessClass = new BusinessLayer.BusinessClass(); // objML_CokeDynamicResult = new ML_CokeDynamicResult(); // string strAdminLoginName = string.Empty; // if (Session["UserName"] != null) // { // strAdminLoginName = Session["UserName"].ToString(); // } // objML_CokeDynamicResult.Id = ML_Common.string2Long(ML_Common.clean(txtId.Text)); // objML_CokeDynamicResult.CokeDynamicResultId = ML_Common.string2Long(ML_Common.clean(txtCokeDynamicResultId.Text)); // objML_CokeDynamicResult.CokeDynamicResult = ML_Common.clean(txtCokeDynamicResult.Text); // objML_CokeDynamicResult.CokeDynamicId = ML_Common.string2int32(ML_Common.clean(txtCokeDynamicId.Text)); // objML_CokeDynamicResult.CokeDynamic = ML_Common.clean(txtCokeDynamic.Text); // objML_CokeDynamicResult.CPCokeId = ML_Common.string2int32(ML_Common.clean(txtCPCokeId.Text)); // objML_CokeDynamicResult.CPCokeName = ML_Common.clean(txtCPCokeName.Text); // objML_CokeDynamicResult.CokeTypeId = ML_Common.string2int32(ML_Common.clean(txtCokeTypeId.Text)); // objML_CokeDynamicResult.CokeType = ML_Common.clean(txtCokeType.Text); // objML_CokeDynamicResult.CokeSupplierId = ML_Common.string2int32(ML_Common.clean(txtCokeSupplierId.Text)); // objML_CokeDynamicResult.CokeSupplier = ML_Common.clean(txtCokeSupplier.Text); // objML_CokeDynamicResult.AnalysisTypeId = ML_Common.string2int32(ML_Common.clean(txtAnalysisTypeId.Text)); // objML_CokeDynamicResult.AnalysisType = ML_Common.clean(txtAnalysisType.Text); // objML_CokeDynamicResult.FieldSize = ML_Common.clean(txtFieldSize.Text); // objML_CokeDynamicResult.FieldUnit = ML_Common.clean(txtFieldUnit.Text); // objML_CokeDynamicResult.FieldSpec = ML_Common.clean(txtFieldSpec.Text); // objML_CokeDynamicResult.MinValue = ML_Common.clean(txtMinValue.Text); // objML_CokeDynamicResult.MaxValue = ML_Common.clean(txtMaxValue.Text); // // objML_CokeDynamicResult.IsActive = ML_Common.clean(ML_Common.bit2int(chkIsActive.Checked).ToString()); // // objML_CokeDynamicResult.IsArchive = ML_Common.clean(ML_Common.bit2int(chkIsArchive.Checked).ToString()); // // objML_CokeDynamicResult.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); // // objML_CokeDynamicResult.CreatedBy = ML_Common.clean(string.Empty); // // objML_CokeDynamicResult.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); // // objML_CokeDynamicResult.ModifiedBy = ML_Common.clean(string.Empty); // int obhReturn = objBusinessClass.AddCokeDynamicResult(objML_CokeDynamicResult); // if (obhReturn == 1) // { // lblMsg.Visible = true; // lblMsg.Text = "Record Saved Successfully"; // } // else if (obhReturn == 2) // { // lblMsg.Text = "Record Already Exists!"; // lblMsg.Visible = true; // } // } // catch (SqlException sqlExc) // { // // LogManager.LogManager.WriteErrorLog(sqlExc); // foreach (SqlError error in sqlExc.Errors) // { // errNumber = error.Number; // } // if (errNumber == 50000) // { // } // return; // } // catch (Exception ex) // { // Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); // } //} }
protected void btnUpdate_Click(object sender, EventArgs e) { lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; if (IsValid) { //errNumber = -1; try { BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = Convert.ToInt32(ViewState["UserNameViewId"]); ML_UserName objML_UserName = objBusinessClass.GetUserNameById(lngId); objML_UserName.UserName = ML_Common.clean(txtUserNameEdit.Text); objML_UserName.FirstName = ML_Common.clean(txtFirstNameEdit.Text); objML_UserName.LastName = ML_Common.clean(txtLastNameEdit.Text); objML_UserName.Email = ML_Common.clean(txtEmailEdit.Text); objML_UserName.Telephone = ML_Common.clean(txtTelephoneEdit.Text); objML_UserName.Mobile = ML_Common.clean(txtMobileEdit.Text); objML_UserName.Remarks = ML_Common.clean(txtRemarksEdit.Text); objML_UserName.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_UserName.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_UserName.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.CreatedBy = ML_Common.clean(string.Empty); objML_UserName.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.ModifiedBy = ML_Common.clean(string.Empty); if (Session["UserName"] != null && Session["UserNameId"] != null) { objML_UserName.CreatedBy = ML_Common.clean(Session["UserName"]); objML_UserName.ModifiedBy = ML_Common.clean(Session["UserName"]); objML_UserName.CreatedByUserNameId = ML_Common.string2int32(ML_Common.clean(Session["UserNameId"])); } int obhReturn = objBusinessClass.UpdateUserName(objML_UserName); if (obhReturn == 1) { lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; FormFieldsClear(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsgEdit.Text = "Record Already Exists!"; } else { lblMsg.Text = "There are some issue while Updating!"; lblMsgEdit.Text = "There are some issue while Updating!"; } UpdatePanelEdit.Update(); } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exx = ex; } } }
private void FillObjectToForm(int lngId, bool IsEditFlag = true) { objBusinessClass = new BusinessLayer.BusinessClass(); ML_CokeSupplier objML_CokeSupplier = objBusinessClass.GetCokeSupplierById(lngId); try { if (objML_CokeSupplier != null) { if (IsEditFlag) { //txtIdEdit.Text = ML_Common.clean(objML_CokeSupplier.Id); //txtCokeSupplierIdEdit.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplierId); txtCokeSupplierEdit.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplier); txtAddress1Edit.Text = ML_Common.clean(objML_CokeSupplier.Address1); txtAddress2Edit.Text = ML_Common.clean(objML_CokeSupplier.Address2); txtAddress3Edit.Text = ML_Common.clean(objML_CokeSupplier.Address3); //txtCityNameEdit.Text = ML_Common.clean(objML_CokeSupplier.CityName); //txtStateNameEdit.Text = ML_Common.clean(objML_CokeSupplier.StateName); //txtPinCodeEdit.Text = ML_Common.clean(objML_CokeSupplier.PinCode); //txtTitleEdit.Text = ML_Common.clean(objML_CokeSupplier.Title); //txtCountryNameEdit.Text = ML_Common.clean(objML_CokeSupplier.CountryName); txtContactPersonEdit.Text = ML_Common.clean(objML_CokeSupplier.ContactPerson); txtMobNoEdit.Text = ML_Common.clean(objML_CokeSupplier.MobNo); // txtWebSiteEdit.Text = ML_Common.clean(objML_CokeSupplier.WebSite); txtEmailEdit.Text = ML_Common.clean(objML_CokeSupplier.Email); txtRemarksEdit.Text = ML_Common.clean(objML_CokeSupplier.Remarks); //txtIsActiveEdit.Text = ML_Common.clean(objML_CokeSupplier.IsActive); //txtIsArchiveEdit.Text = ML_Common.clean(objML_CokeSupplier.IsArchive); //txtCreatedDateEdit.Text = ML_Common.clean(objML_CokeSupplier.CreatedDate); //txtCreatedByEdit.Text = ML_Common.clean(objML_CokeSupplier.CreatedBy); //txtModifiedDateEdit.Text = ML_Common.clean(objML_CokeSupplier.ModifiedDate); //txtModifiedByEdit.Text = ML_Common.clean(objML_CokeSupplier.ModifiedBy); //txtCreatedByUserNameIdEdit.Text = ML_Common.clean(objML_CokeSupplier.CreatedByUserNameId); } else { //lblId.Text = ML_Common.clean(objML_CokeSupplier.Id); //lblCokeSupplierId.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplierId); lblCokeSupplier.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplier); lblAddress1.Text = ML_Common.clean(objML_CokeSupplier.Address1); lblAddress2.Text = ML_Common.clean(objML_CokeSupplier.Address2); lblAddress3.Text = ML_Common.clean(objML_CokeSupplier.Address3); //lblCityName.Text = ML_Common.clean(objML_CokeSupplier.CityName); //lblStateName.Text = ML_Common.clean(objML_CokeSupplier.StateName); //lblPinCode.Text = ML_Common.clean(objML_CokeSupplier.PinCode); //lblTitle.Text = ML_Common.clean(objML_CokeSupplier.Title); //lblCountryName.Text = ML_Common.clean(objML_CokeSupplier.CountryName); lblContactPerson.Text = ML_Common.clean(objML_CokeSupplier.ContactPerson); lblMobNo.Text = ML_Common.clean(objML_CokeSupplier.MobNo); lblWebSite.Text = ML_Common.clean(objML_CokeSupplier.WebSite); lblEmail.Text = ML_Common.clean(objML_CokeSupplier.Email); lblRemarks.Text = ML_Common.clean(objML_CokeSupplier.Remarks); //lblIsActive.Text = ML_Common.clean(objML_CokeSupplier.IsActive); //lblIsArchive.Text = ML_Common.clean(objML_CokeSupplier.IsArchive); //lblCreatedDate.Text = ML_Common.clean(objML_CokeSupplier.CreatedDate); //lblCreatedBy.Text = ML_Common.clean(objML_CokeSupplier.CreatedBy); //lblModifiedDate.Text = ML_Common.clean(objML_CokeSupplier.ModifiedDate); //lblModifiedBy.Text = ML_Common.clean(objML_CokeSupplier.ModifiedBy); //lblCreatedByUserNameId.Text = ML_Common.clean(objML_CokeSupplier.CreatedByUserNameId); } } } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeSupplier = new ML_CokeSupplier(); objML_CokeSupplier.CokeSupplier = ML_Common.string2string(txtCokeSupplier.Text); objML_CokeSupplier.Address1 = ML_Common.clean(txtAddress1.Text); objML_CokeSupplier.Address2 = ML_Common.clean(txtAddress2.Text); objML_CokeSupplier.Address3 = ML_Common.clean(txtAddress3.Text); objML_CokeSupplier.CityName = string.Empty; // ML_Common.clean(txtCityName.Text); objML_CokeSupplier.StateName = string.Empty; // ML_Common.clean(txtStateName.Text); objML_CokeSupplier.PinCode = string.Empty; // ML_Common.clean(txtPinCode.Text); objML_CokeSupplier.Title = string.Empty; //ML_Common.clean(txtTitle.Text); objML_CokeSupplier.CountryName = string.Empty; //ML_Common.clean(txtCountryName.Text); objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPerson.Text); objML_CokeSupplier.MobNo = ML_Common.clean(txtMobNo.Text); objML_CokeSupplier.WebSite = string.Empty;// ML_Common.clean(txtWebSite.Text); objML_CokeSupplier.Email = ML_Common.clean(txtEmail.Text); objML_CokeSupplier.Remarks = ML_Common.clean(txtRemarks.Text); objML_CokeSupplier.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.CreatedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.ModifiedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameId.Text)); int obhReturn = objBusinessClass.AddCokeSupplier(objML_CokeSupplier); if (obhReturn == 1) { lblMsg.Text = "Record Saved Successfully"; FormFieldsClear(); } else { lblMsg.Text = "Record Already Exists!"; FormFieldsClear(); } } catch (SqlException sqlExc) { lblMsg.Text = "Record Already Exists!"; SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } }