protected void grdvwSla_RowDeleting(object sender, GridViewDeleteEventArgs e) { int SLAid; SLAid = Convert.ToInt16(grdvwSla.Rows[e.RowIndex].Cells[0].Text); objSlaPriority.Delete(SLAid); objSla.Delete(SLAid); BindGrid(); }
protected void btnSave_Click(object sender, EventArgs e) { // Declare local variable varsiteid,FlagInsertSla and FlagStatus int varsiteid; ServiceWindow_mst objservicewindow = new ServiceWindow_mst(); varsiteid = Convert.ToInt16(drpSites.SelectedValue); int count = objservicewindow.Get_ServiceWindow_By_Siteid(varsiteid); if (count >= 1) { int FlagInsertSla; int FlagStatus; bool FlagEscalateLevel1 = true; bool FlagEscalateLevel2 = true; bool FlagEscalateLevel3 = true; lblErrorTimeSelect.Text = ""; if (txtDays.Text == "0" && drphr.SelectedValue == "0" && drpMin.SelectedValue == "0") { lblErrorTimeSelect.Text = Resources.MessageResource.errResTime.ToString(); } else { if (chkLevel1.Checked == true) { if (radio1Level1.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel1 = calculateTotalminutesLevel1(); if (varTotalTimeLevel1 > varTotalTime) { FlagEscalateLevel1 = false; } } if (radio2Level1.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel1 = calculateTotalminutesLevel1(); if (varTotalTimeLevel1 == 0) { FlagEscalateLevel1 = false; } } } if (chkLevel2.Checked == true) { if (radio1Level2.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel2 = calculateTotalminutesLevel2(); if (varTotalTimeLevel2 > varTotalTime) { FlagEscalateLevel2 = false; } } if (radio2Level2.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel2 = calculateTotalminutesLevel2(); if (varTotalTimeLevel2 == 0) { FlagEscalateLevel2 = false; } } } if (chkLevel3.Checked == true) { if (radio1Level3.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel3 = calculateTotalminutesLevel3(); if (varTotalTimeLevel3 > varTotalTime) { FlagEscalateLevel3 = false; } } if (radio2Level3.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel3 = calculateTotalminutesLevel3(); if (varTotalTimeLevel3 == 0) { FlagEscalateLevel3 = false; } } } // get sitetd from dropdown to variable varsiteid // Check SLA Definition is exist in database with same name and site objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid); // Check SLA Priority definition is exist in databse with siteid and priorityid objSlaPriority = objSlaPriority.Get_By_Siteid(varsiteid, Convert.ToInt16(drpPriority.SelectedValue)); // if both objSla.Siteid and objSlaPriority.Slaid is zero then,No SLA Definition is exist in database if (objSla.Siteid == 0 && objSlaPriority.Slaid == 0) { if (FlagEscalateLevel1 == true && FlagEscalateLevel2 == true && FlagEscalateLevel3 == true) { objSla.Siteid = varsiteid; objSla.Slaname = txtSlaName.Text.ToString().Trim(); objSla.Createdatetime = DateTime.Now.ToString(); objSla.Enable = true; objSla.Description = txtDescription.Text.ToString().Trim(); // Call objSla.Insert() to insert records in database FlagInsertSla = objSla.Insert(); // If FlagInsertSla is 1 then record insert in database successfully if (FlagInsertSla == 1) { // Call Function objSla.Get_By_SLAName() to get Slaid of created sla objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid); if (objSla.Siteid != 0) { // declare local variable FlagInsertPriority int FlagInsertPriority; objSlaPriority.Slaid = objSla.Slaid; objSlaPriority.Siteid = varsiteid; objSlaPriority.Priorityid = Convert.ToInt16(drpPriority.SelectedValue); objSlaPriority.Resolutiondays = Convert.ToInt16(txtDays.Text); objSlaPriority.Resolutionhours = Convert.ToInt16(drphr.SelectedValue); objSlaPriority.Resolutionmin = Convert.ToInt16(drpMin.SelectedValue); // Call function objSlaPriority.Insert() to insert records in SLA_Priority_mst FlagInsertPriority = objSlaPriority.Insert(); // if FlagInsertPriority is not zero then records insert successfully if (FlagInsertPriority != 0) { //lblErrorMsg.Text = Resources.MessageResource.errSLADef.ToString(); if (chkLevel1.Checked == true) { InsertIntoLevel1(objSla.Slaid); } if (chkLevel2.Checked == true) { InsertIntoLevel2(objSla.Slaid); } if (chkLevel3.Checked == true) { InsertIntoLevel3(objSla.Slaid); } Clear(); Response.Redirect("~/admin/viewsla.aspx"); //CheckDefaultValueForEscalation(); } else { // Call objSla.Delete to delete record from SLA_mst to delete sla definition,because some error occurred in SLA_Priority_mst objSla.Delete(objSla.Slaid); // Display Error message some error occurred lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString(); } } } } else { if (FlagEscalateLevel1 == false) { lblErrorMsg.Text = Resources.MessageResource.strLevel1.ToString(); } if (FlagEscalateLevel2 == false) { lblErrorMsg.Text = Resources.MessageResource.strLevel2.ToString(); } if (FlagEscalateLevel3 == false) { lblErrorMsg.Text = Resources.MessageResource.strLevel3.ToString(); } } } else { lblErrorMsg.Text = Resources.MessageResource.errSLAExist.ToString(); } } } else { lblErrorMsg.Text = "Service Window not set for this Site,Set the Service Window for this Site"; } }
protected void btnSave_Click(object sender, EventArgs e) { // Declare local variable varsiteid,FlagInsertSla and FlagStatus int varsiteid; ServiceWindow_mst objservicewindow = new ServiceWindow_mst(); varsiteid = Convert.ToInt16(drpSites.SelectedValue); int count = objservicewindow.Get_ServiceWindow_By_Siteid(varsiteid); if (count >= 1) { int FlagInsertSla; int FlagStatus; bool FlagEscalateLevel1 = true; bool FlagEscalateLevel2 = true; bool FlagEscalateLevel3 = true; lblErrorTimeSelect.Text = ""; if (txtDays.Text == "0" && drphr.SelectedValue == "0" && drpMin.SelectedValue == "0") { lblErrorTimeSelect.Text = Resources.MessageResource.errResTime.ToString(); } else { if (chkLevel1.Checked == true) { if (radio1Level1.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel1 = calculateTotalminutesLevel1(); if (varTotalTimeLevel1 > varTotalTime) { FlagEscalateLevel1 = false; } } if (radio2Level1.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel1 = calculateTotalminutesLevel1(); if (varTotalTimeLevel1 ==0) { FlagEscalateLevel1 = false; } } } if (chkLevel2.Checked == true) { if (radio1Level2.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel2 = calculateTotalminutesLevel2(); if (varTotalTimeLevel2 > varTotalTime) { FlagEscalateLevel2 = false; } } if (radio2Level2.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel2 = calculateTotalminutesLevel2(); if (varTotalTimeLevel2 == 0) { FlagEscalateLevel2 = false; } } } if (chkLevel3.Checked == true) { if (radio1Level3.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel3 = calculateTotalminutesLevel3(); if (varTotalTimeLevel3 > varTotalTime) { FlagEscalateLevel3 = false; } } if (radio2Level3.Checked == true) { int varTotalTime = calculateTotalminutes(); int varTotalTimeLevel3 = calculateTotalminutesLevel3(); if (varTotalTimeLevel3 == 0) { FlagEscalateLevel3 = false; } } } // get sitetd from dropdown to variable varsiteid // Check SLA Definition is exist in database with same name and site objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid); // Check SLA Priority definition is exist in databse with siteid and priorityid objSlaPriority = objSlaPriority.Get_By_Siteid(varsiteid, Convert.ToInt16(drpPriority.SelectedValue)); // if both objSla.Siteid and objSlaPriority.Slaid is zero then,No SLA Definition is exist in database if (objSla.Siteid == 0 && objSlaPriority.Slaid == 0) { if (FlagEscalateLevel1 == true && FlagEscalateLevel2 == true && FlagEscalateLevel3 == true) { objSla.Siteid = varsiteid; objSla.Slaname = txtSlaName.Text.ToString().Trim(); objSla.Createdatetime = DateTime.Now.ToString(); objSla.Enable = true; objSla.Description = txtDescription.Text.ToString().Trim(); // Call objSla.Insert() to insert records in database FlagInsertSla = objSla.Insert(); // If FlagInsertSla is 1 then record insert in database successfully if (FlagInsertSla == 1) { // Call Function objSla.Get_By_SLAName() to get Slaid of created sla objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid); if (objSla.Siteid != 0) { // declare local variable FlagInsertPriority int FlagInsertPriority; objSlaPriority.Slaid = objSla.Slaid; objSlaPriority.Siteid = varsiteid; objSlaPriority.Priorityid = Convert.ToInt16(drpPriority.SelectedValue); objSlaPriority.Resolutiondays = Convert.ToInt16(txtDays.Text); objSlaPriority.Resolutionhours = Convert.ToInt16(drphr.SelectedValue); objSlaPriority.Resolutionmin = Convert.ToInt16(drpMin.SelectedValue); // Call function objSlaPriority.Insert() to insert records in SLA_Priority_mst FlagInsertPriority = objSlaPriority.Insert(); // if FlagInsertPriority is not zero then records insert successfully if (FlagInsertPriority != 0) { //lblErrorMsg.Text = Resources.MessageResource.errSLADef.ToString(); if (chkLevel1.Checked == true) { InsertIntoLevel1(objSla.Slaid); } if (chkLevel2.Checked == true) { InsertIntoLevel2(objSla.Slaid); } if (chkLevel3.Checked == true) { InsertIntoLevel3(objSla.Slaid); } Clear(); Response.Redirect("~/admin/viewsla.aspx"); //CheckDefaultValueForEscalation(); } else { // Call objSla.Delete to delete record from SLA_mst to delete sla definition,because some error occurred in SLA_Priority_mst objSla.Delete(objSla.Slaid); // Display Error message some error occurred lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString(); } } } } else { if (FlagEscalateLevel1 == false) { lblErrorMsg.Text = Resources.MessageResource.strLevel1.ToString(); } if (FlagEscalateLevel2 == false) { lblErrorMsg.Text = Resources.MessageResource.strLevel2.ToString(); } if (FlagEscalateLevel3 == false) { lblErrorMsg.Text = Resources.MessageResource.strLevel3.ToString(); } } } else { lblErrorMsg.Text = Resources.MessageResource.errSLAExist.ToString(); } } } else { lblErrorMsg.Text = "Service Window not set for this Site,Set the Service Window for this Site"; } }