protected void btnSave_Click(object sender, EventArgs e) { ProblemsTypes objProblemTypes = new ProblemsTypes(); objProblemTypes.ProblemTypeDesc = txtProblemTypeDesc.Text; objProblemTypes.Status = 1; if (!string.IsNullOrEmpty(hfProblemTypeID.Value.ToString())) { objProblemTypes.UpdatedBy = UserAuthentication.GetUserId(this.Page); objProblemTypes.UpdatedDate = DateTime.Now; objProblemTypes.ProblemTypeID = Convert.ToInt32(hfProblemTypeID.Value); objProblemTypes.ProblemTypeDesc = txtProblemTypeDesc.Text; ProblemTypesBO.UpdateProblemsTypes(objProblemTypes); } else { objProblemTypes.CreatedBy = UserAuthentication.GetUserId(this.Page); objProblemTypes.CreatedDate = DateTime.Now; ProblemTypesBO.InsertProblemTypes(objProblemTypes); } txtProblemTypeDesc.Text = string.Empty; hfProblemTypeID.Value = string.Empty; loadProblemTypes(); }
public int InsertProblemTypes(ProblemsTypes objProblemTypes) { objProblemTypes.ProblemTypeID = 1; BeginTransaction(); try { objProblemTypes.ProblemTypeID = Insert(objProblemTypes); CommitTransaction(); } catch (Exception ex) { RollBackTransaction(); objProblemTypes.ProblemTypeID = -1; } return objProblemTypes.ProblemTypeID; }
protected void gvProblemType_RowCommand(object sender, GridViewCommandEventArgs e) { hfProblemTypeID.Value = e.CommandArgument.ToString(); ProblemsTypes objProblemTypes = new ProblemsTypes(); if (e.CommandName.Equals("cmdEdit")) { objProblemTypes = ProblemTypesBO.GetProblemsTypes(Convert.ToInt32(e.CommandArgument)); txtProblemTypeDesc.Text = objProblemTypes.ProblemTypeDesc; } else if (e.CommandName.Equals("cmdDelete")) { int ProblemTypeID = Convert.ToInt32(e.CommandArgument); objProblemTypes.ProblemTypeID = ProblemTypeID; objProblemTypes.Status = 0; ProblemTypesBO.DeleteProblemsTypes(objProblemTypes); loadProblemTypes(); } }
public int DeleteProblemsTypes(ProblemsTypes objProblemsTypes) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "Status" }; rowsaffected = Update(objProblemsTypes, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }