protected void btnSubmit_Click(object sender, System.EventArgs e) { objProblemPriority = new Model.clsProblemPriority(); objBLProblemPriority = new BusinessLayer.clsBLProblemPriority(); objProblemPriority.ProblemPriorityName = Server.HtmlEncode(Convert.ToString(txtProblemPriority.Text.Trim())); objProblemPriority.isActive = Convert.ToInt32(ddlisActive.SelectedItem.Value); objProblemPriority.GreenResolutionHours = Convert.ToInt32(txtGreenResolutionHours.Text.Trim()); objProblemPriority.AmberResolutionHours = Convert.ToInt32(txtAmberResolutionHours.Text.Trim()); // DataSet dsDuplicateProblemPriority = new DataSet(); try { // if(txtProblemPriority.Text.Trim()=="") // { // lblDuplicateProblemPriority.Visible=true; // lblDuplicateProblemPriority.Text="Please enter a problem priority"; // GetProblemPriorityList(); // } // else // { // int dsDuplicateProblemPriority; dsDuplicateProblemPriority = objBLProblemPriority.IsDuplicateProblemPriority(objProblemPriority); if (dsDuplicateProblemPriority.Tables[0].Rows.Count > 0) { // lblDuplicateProblemPriority.Visible=true; lblDuplicateProblemPriority.Text = "Duplicate problem priority"; GetProblemPriorityList(); } else { lblDuplicateProblemPriority.Text = ""; pnlAddEditProblemPriority.Visible = false; recordfound = objBLProblemPriority.AddNewProblemPriority(objProblemPriority); if (recordfound) { lblMsg.Visible = true; lblMsg.CssClass = "success"; lblMsg.Text = "Record inserted successfully"; GetProblemPriorityList(); } else { lblMsg.Visible = true; lblMsg.Text = "Error while inserting record"; GetProblemPriorityList(); } } // } } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "ProblemPriorityMaster.aspx", "btnSubmit_Click", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public void dgProblemPriority_Update(object Sender, DataGridCommandEventArgs e) { try { objProblemPriority = new Model.clsProblemPriority(); objBLProblemPriority = new BusinessLayer.clsBLProblemPriority(); int intProblemPriorityID = Convert.ToInt32((dgProblemPriority.DataKeys[e.Item.ItemIndex]).ToString()); TextBox strNewProblemPriority = (TextBox)e.Item.FindControl("txtNewProblemPriority"); TextBox strNewGreenResolutionHours = (TextBox)e.Item.FindControl("txtNewGreenResolutionHours"); TextBox strNewAmberResolutionHours = (TextBox)e.Item.FindControl("txtNewAmberResolutionHours"); int strIsActive = ((DropDownList)e.Item.FindControl("ddlisActive1")).SelectedIndex; objProblemPriority.ProblemPriorityID = intProblemPriorityID; objProblemPriority.isActive = strIsActive; if (strNewProblemPriority.Text.Trim() == "") { lblMsg.Text = "Please enter a problem priority"; GetProblemPriorityList(); } else if (strNewProblemPriority.Text.Trim() != "") { objProblemPriority.ProblemPriorityName = Server.HtmlEncode(Convert.ToString(strNewProblemPriority.Text.Trim().Replace("&", "&"))); dsDuplicateProblemPriority = objBLProblemPriority.IsDuplicateProblemPriority(objProblemPriority); if (dsDuplicateProblemPriority.Tables[0].Rows.Count > 0) { lblMsg.Text = "Duplicate problem priority"; GetProblemPriorityList(); } else { objProblemPriority.ProblemPriorityName = Server.HtmlEncode(Convert.ToString(strNewProblemPriority.Text.Trim())); if (strNewGreenResolutionHours.Text.Trim() == "") { lblMsg.Text = "Please enter an integer value for Green Resolution Hours"; GetProblemPriorityList(); } else if (strNewGreenResolutionHours.Text.Trim() != "") { string strNewGreenResolution = strNewGreenResolutionHours.Text.Trim(); if (strNewGreenResolution.StartsWith("0") || strNewGreenResolution.StartsWith("1") || strNewGreenResolution.StartsWith("2") || strNewGreenResolution.StartsWith("3") || strNewGreenResolution.StartsWith("4") || strNewGreenResolution.StartsWith("5") || strNewGreenResolution.StartsWith("6") || strNewGreenResolution.StartsWith("7") || strNewGreenResolution.StartsWith("8") || strNewGreenResolution.StartsWith("9")) { objProblemPriority.GreenResolutionHours = Convert.ToInt32(strNewGreenResolution); if (strNewAmberResolutionHours.Text.Trim() == "") { lblMsg.Text = "Please enter an integer value for Amber Resolution Hours"; GetProblemPriorityList(); } else if (strNewAmberResolutionHours.Text.Trim() != "") { string strNewAmberResolution = strNewAmberResolutionHours.Text.Trim(); if (strNewAmberResolution.StartsWith("0") || strNewAmberResolution.StartsWith("1") || strNewAmberResolution.StartsWith("2") || strNewAmberResolution.StartsWith("3") || strNewAmberResolution.StartsWith("4") || strNewAmberResolution.StartsWith("5") || strNewAmberResolution.StartsWith("6") || strNewAmberResolution.StartsWith("7") || strNewAmberResolution.StartsWith("8") || strNewAmberResolution.StartsWith("9")) { objProblemPriority.AmberResolutionHours = Convert.ToInt32(strNewAmberResolution); recordcount = objBLProblemPriority.UpdateProblemPriority(objProblemPriority); if (recordcount > 0) { if (strIsActive == 0) { Page.RegisterStartupScript("key", "<script>alert('Cannot edit this Problem Priority as issues found.');</script>"); } else { dgProblemPriority.EditItemIndex = -1; lblMsg.Text = ""; GetProblemPriorityList(); } } else { dgProblemPriority.EditItemIndex = -1; lblMsg.Text = ""; GetProblemPriorityList(); } } else { lblMsg.Text = "Please enter an integer value for Amber Resolution Hours"; GetProblemPriorityList(); } } /*dgProblemPriority.EditItemIndex = -1; * lblMsg.Text=""; * GetProblemPriorityList();*/ } else { lblMsg.Text = "Please enter an integer value for Green Resolution Hours"; GetProblemPriorityList(); } } } } } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "ProblemPriorityMaster.aspx", "dgProblemPriority_Update", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }