protected void gvCaste_RowCommand(object sender, GridViewCommandEventArgs e) { hfCasteID.Value = e.CommandArgument.ToString(); Caste objCaste = new Caste(); if (e.CommandName.Equals("cmdEdit")) { objCaste = CasteBO.GetCaste(Convert.ToInt32(e.CommandArgument)); txtCasteName.Text = objCaste.CasteName; ddlEthnicityID.SelectedValue = objCaste.EthnicityID.ToString(); if (objCaste.IsDiscriminated == 1) { rbDiscriminatedYes.Checked = true; rbDiscriminatedNo.Checked = false; } else { rbDiscriminatedNo.Checked = true; rbDiscriminatedYes.Checked = false; } txtCasteName.Focus(); } else if (e.CommandName.Equals("cmdDelete")) { int CasteID = Convert.ToInt32(e.CommandArgument); objCaste.CasteID = CasteID; objCaste.Status = 0; CasteBO.DeleteCaste(objCaste); loadCasteView(); } }
protected void btnSave_Click(object sender, EventArgs e) { Caste objCaste = new Caste(); objCaste.CasteName = txtCasteName.Text; objCaste.EthnicityID = Convert.ToInt32(ddlEthnicityID.SelectedValue); objCaste.IsDiscriminated = Convert.ToInt32(rbDiscriminatedYes.Checked); objCaste.Status = 1; if (!string.IsNullOrEmpty(hfCasteID.Value.ToString())) { objCaste.UpdatedBy = UserAuthentication.GetUserId(this.Page); objCaste.UpdatedDate = DateTime.Now; objCaste.CasteID = Convert.ToInt32(hfCasteID.Value); objCaste.CasteName = txtCasteName.Text; objCaste.EthnicityID = Convert.ToInt32(ddlEthnicityID.SelectedValue); CasteBO.UpdateCaste(objCaste); } else { objCaste.CreatedBy = UserAuthentication.GetUserId(this.Page); objCaste.CreatedDate = DateTime.Now; CasteBO.InsertCaste(objCaste); } txtCasteName.Text = string.Empty; hfCasteID.Value = string.Empty; loadCasteView(); loadEthnicity(); }
public int InsertCaste(Caste objCaste) { objCaste.CasteID = 1; BeginTransaction(); try { objCaste.CasteID = Insert(objCaste); CommitTransaction(); } catch (Exception ex) { RollBackTransaction(); objCaste.CasteID = -1; } return objCaste.CasteID; }
public int UpdateCaste(Caste objCaste) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "CasteName", "EthnicityID", "UpdatedBy", "UpdatedDate", "IsDiscriminated", "Status", "SyncStatus" }; rowsaffected = Update(objCaste, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }
public static int DeleteCaste(Caste objCaste) { return new CasteDAO().DeleteCaste(objCaste); }
public static int UpdateCaste(Caste objCaste) { return new CasteDAO().UpdateCaste(objCaste); }
public static Caste GetCaseType(int CasteID) { Caste objCaseType = new Caste(); return (Caste)(new CasteDAO().FillDTO(objCaseType, "CasteID=" + CasteID)); }
public static int InsertCaste(Caste objCaste) { return new CasteDAO().InsertCaste(objCaste); }
public int DeleteCaste(Caste objCaste) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "Status" }; rowsaffected = Update(objCaste, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }