private void FillGrid() { try { DataTable DtList = null; if (ViewState["grdUserName"] == null) { if (ddlUserTypeSearch.SelectedIndex > 0) { objML_UserName.UserTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlUserTypeSearch, true)); objML_UserName.UserType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlUserTypeSearch, false)); DtList = BindGridViewBySearch(objML_UserName); ViewState["grdUserName"] = DtList; } } else { DtList = (DataTable)ViewState["grdUserName"]; } if (DtList != null) { if (DtList.Rows.Count > 0) { grdUserName.DataSource = DtList; grdUserName.DataBind(); } else { DtList.Rows.Add(DtList.NewRow()); grdUserName.DataSource = DtList; grdUserName.DataBind(); int TotalColumns = grdUserName.Rows[0].Cells.Count; grdUserName.Rows[0].Cells.Clear(); grdUserName.Rows[0].Cells.Add(new TableCell()); grdUserName.Rows[0].Cells[0].ColumnSpan = TotalColumns; grdUserName.Rows[0].Cells[0].Text = "No Record Found"; } UpdatePanelGrid.Update(); } } 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(); } }
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); } } }
private void FillGrid() { try { DataTable DtList = null; ML_SanitizationReport objML_SanitizationReportSearch = new ML_SanitizationReport(); if (ddlReportTypeSearch.SelectedIndex > 0 && !string.IsNullOrEmpty(txtFromDateSearch.Text) && !string.IsNullOrEmpty(txtToDateSearch.Text)) { objML_SanitizationReportSearch.ReportType = ML_Common.GetDropDownValue(ddlReportTypeSearch, true); objML_SanitizationReportSearch.TagStatus = null; DateTime FromDateSearch = ML_Common.ToDateTimeSafe(txtFromDateSearch.Text); DateTime ToDateSearch = ML_Common.ToDateTimeSafe(txtToDateSearch.Text); var FromTimeSearch = TimeSpan.Parse("00:00:00"); var FromFullDt = FromDateSearch + FromTimeSearch; // 2010-06-26 01:16:50 var ToTimeSearch = TimeSpan.Parse("23:59:59"); var ToFullDt = ToDateSearch + ToTimeSearch; // 2010-06-26 01:16:50 var From24Hour = FromFullDt.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.CurrentCulture); var To24Hour = ToFullDt.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.CurrentCulture); objML_SanitizationReportSearch.FromDate = ML_Common.ToDateTimeSafeNull(From24Hour.ToString()); objML_SanitizationReportSearch.ToDate = ML_Common.ToDateTimeSafeNull(To24Hour.ToString()); DtList = BindGridViewBySearch(objML_SanitizationReportSearch); } if (DtList != null) { //DtList = (DataTable)ViewState["grdSanitizationReportTM"]; if (DtList.Rows.Count > 0) { grdSanitizationReport.DataSource = DtList; grdSanitizationReport.DataBind(); } else { DtList.Rows.Add(DtList.NewRow()); grdSanitizationReport.DataSource = DtList; grdSanitizationReport.DataBind(); int TotalColumns = grdSanitizationReport.Rows[0].Cells.Count; grdSanitizationReport.Rows[0].Cells.Clear(); grdSanitizationReport.Rows[0].Cells.Add(new TableCell()); grdSanitizationReport.Rows[0].Cells[0].ColumnSpan = TotalColumns; grdSanitizationReport.Rows[0].Cells[0].Text = "No Record Found"; } UpdatePanelGrid.Update(); } } catch (Exception ex) { Exception exc = 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 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); // } //} }