protected void btnSave_Click(object sender, EventArgs e) { OccupationTypes objOccupationTypes = new OccupationTypes(); objOccupationTypes.OccupationTypeDesc = txtOccupationTypeDesc.Text; objOccupationTypes.Status = 1; if (!string.IsNullOrEmpty(hfOccupationTypeID.Value.ToString())) { objOccupationTypes.UpdatedBy = UserAuthentication.GetUserId(this.Page); objOccupationTypes.UpdatedDate = DateTime.Now; objOccupationTypes.OccupationTypeID = Convert.ToInt32(hfOccupationTypeID.Value); objOccupationTypes.OccupationTypeDesc = txtOccupationTypeDesc.Text; OccupationTypeBO.UpdateOccupationTypes(objOccupationTypes); } else { objOccupationTypes.CreatedBy = UserAuthentication.GetUserId(this.Page); objOccupationTypes.CreatedDate = DateTime.Now; OccupationTypeBO.InsertOccupationType(objOccupationTypes); } txtOccupationTypeDesc.Text = string.Empty; hfOccupationTypeID.Value = string.Empty; loadOccupationType(); }
public int InsertOccupationType(OccupationTypes objOccupationType) { objOccupationType.OccupationTypeID = 1; BeginTransaction(); try { objOccupationType.OccupationTypeID = Insert(objOccupationType); CommitTransaction(); } catch (Exception ex) { RollBackTransaction(); objOccupationType.OccupationTypeID = -1; } return objOccupationType.OccupationTypeID; }
protected void gvOccupationType_RowCommand(object sender, GridViewCommandEventArgs e) { hfOccupationTypeID.Value = e.CommandArgument.ToString(); OccupationTypes objOccupationTypes = new OccupationTypes(); if (e.CommandName.Equals("cmdEdit")) { objOccupationTypes = OccupationTypeBO.GetOccupationType(Convert.ToInt32(e.CommandArgument)); txtOccupationTypeDesc.Text = objOccupationTypes.OccupationTypeDesc; } else if (e.CommandName.Equals("cmdDelete")) { int OccupationTypeID = Convert.ToInt32(e.CommandArgument); objOccupationTypes.OccupationTypeID = OccupationTypeID; objOccupationTypes.Status = 0; OccupationTypeBO.DeleteOccupationTypes(objOccupationTypes); loadOccupationType(); } }
public int DeleteOccupationTypes(OccupationTypes objOccupationTypes) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "Status" }; rowsaffected = Update(objOccupationTypes, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }
public static int DeleteOccupationTypes(OccupationTypes objOccupationTypes) { return new OccupationTypeDAO().DeleteOccupationTypes(objOccupationTypes); }
public static int UpdateOccupationTypes(OccupationTypes objOccupationTypes) { return new OccupationTypeDAO().UpdateOccupationTypes(objOccupationTypes); }
public static OccupationTypes GetOccupationType(int OccupationTypeID) { OccupationTypes objOccupationType = new OccupationTypes(); return (OccupationTypes)(new OccupationTypeDAO().FillDTO(objOccupationType, "OccupationTypeID=" + OccupationTypeID)); }
public static int InsertOccupationType(OccupationTypes objOccupationType) { return new OccupationTypeDAO().InsertOccupationType(objOccupationType); }