Esempio n. 1
0
        protected void btnSubmit_Click(object sender, System.EventArgs e)
        {
            try
            {
                objProblemSeverity   = new Model.clsProblemSeverity();
                objBLProblemSeverity = new BusinessLayer.clsBLProblemSeverity();
                DataSet dsDuplicateProblemSeverity = new DataSet();
                objProblemSeverity.ProblemSeverityName = Server.HtmlEncode(Convert.ToString(txtProblemSeverity.Text.Trim()));
                objProblemSeverity.isActive            = Convert.ToInt32(ddlisActive.SelectedItem.Value);

                dsDuplicateProblemSeverity = objBLProblemSeverity.IsDuplicateProblemSeverity(objProblemSeverity);
                if (dsDuplicateProblemSeverity.Tables[0].Rows.Count > 0)
                {
                    lblDuplicateProblemSeverity.Text = "Duplicate problem severity";
                    GetProblemSeverityList();
                }
                else
                {
                    lblDuplicateProblemSeverity.Text = "";
                    recordfound = objBLProblemSeverity.AddNewProblemSeverity(objProblemSeverity);
                    if (recordfound)
                    {
                        lblMsg.Visible  = true;
                        lblMsg.CssClass = "success";
                        lblMsg.Text     = "Record inserted successfully";
                        pnlAddEditProblemSeverity.Visible = false;
                        GetProblemSeverityList();
                    }
                    else
                    {
                        lblMsg.Visible = true;
                        lblMsg.Text    = "Error while inserting record";
                        GetProblemSeverityList();
                    }
                }
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "ProblemSeverityMaster.aspx", "btnSubmit_Click", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
Esempio n. 2
0
        public void dgProblemSeverity_Update(object Sender, DataGridCommandEventArgs e)
        {
            try
            {
                objProblemSeverity   = new Model.clsProblemSeverity();
                objBLProblemSeverity = new BusinessLayer.clsBLProblemSeverity();
                DataSet dsDuplicateProblemSeverity = new DataSet();
                int     intProblemSeverityID       = Convert.ToInt32((dgProblemSeverity.DataKeys[e.Item.ItemIndex]).ToString());
                TextBox strNewProblemSeverity      = (TextBox)e.Item.FindControl("txtNewProblemSeverity");
                int     strIsActive = ((DropDownList)e.Item.FindControl("ddlisActive1")).SelectedIndex;
                objProblemSeverity.ProblemSeverityID   = intProblemSeverityID;
                objProblemSeverity.ProblemSeverityName = Server.HtmlEncode(Convert.ToString(strNewProblemSeverity.Text.Trim()));
                objProblemSeverity.isActive            = strIsActive;

                if (objProblemSeverity.ProblemSeverityName == "")
                {
                    lblMsg.Visible = true;
                    lblMsg.Text    = "Please enter a problem severity";
                    GetProblemSeverityList();
                }
                else
                {
                    dsDuplicateProblemSeverity = objBLProblemSeverity.IsDuplicateProblemSeverity(objProblemSeverity);
                    if (dsDuplicateProblemSeverity.Tables[0].Rows.Count > 0)
                    {
                        lblMsg.Visible = true;
                        lblMsg.Text    = "Duplicate problem severity";
                        GetProblemSeverityList();
                    }
                    else
                    {
                        recordcount = objBLProblemSeverity.UpdateProblemSeverity(objProblemSeverity);
                        if (recordcount > 0)
                        {
                            if (strIsActive == 0)
                            {
                                Page.RegisterStartupScript("key", "<script>alert('Cannot edit this Problem Severity Status as issues found');</script>");
                            }
                        }
                        else
                        {
                            dgProblemSeverity.EditItemIndex = -1;
                            GetProblemSeverityList();
                        }
                    }
                    dgProblemSeverity.EditItemIndex = -1;
                    GetProblemSeverityList();
                    lblSuccessMsgs.Visible = true;
                    lblSuccessMsgs.Text    = "Details updated successfully";
                }
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "ProblemSeverityMaster.aspx", "dgProblemSeverity_Update", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }