protected void btnSave_Click(object sender, EventArgs e) { PassportStatus objPassportStatus = new PassportStatus(); objPassportStatus.PassportStatusDesc = txtPassportStatusDesc.Text; objPassportStatus.Status = 1; if (!string.IsNullOrEmpty(hfPassportStatusID.Value.ToString())) { objPassportStatus.UpdatedBy = UserAuthentication.GetUserId(this.Page); objPassportStatus.UpdatedDate = DateTime.Now; objPassportStatus.PassportStatusID = Convert.ToInt32(hfPassportStatusID.Value); objPassportStatus.PassportStatusDesc = txtPassportStatusDesc.Text; PassportStatusBO.UpdatePassportStatus(objPassportStatus); } else { objPassportStatus.CreatedBy = UserAuthentication.GetUserId(this.Page); objPassportStatus.CreatedDate = DateTime.Now; PassportStatusBO.InsertPassportStatus(objPassportStatus); } txtPassportStatusDesc.Text = string.Empty; hfPassportStatusID.Value = string.Empty; loadPassportStatus(); }
// GET api/passportstatus public IEnumerable<PassportStatus> Get() { List<PassportStatus> listPassportStatus = new List<PassportStatus>(); DataView dvPassportStatus = PassportStatusBO.GetPassporttatusIDForSync(); foreach (DataRowView drvPassportStatus in dvPassportStatus) { PassportStatus status = new PassportStatus(); listPassportStatus.Add(PassportStatusBO.GetPassportStatus(Convert.ToInt32(drvPassportStatus["PassportStatusID"]))); } return listPassportStatus; }
public int InsertPassportStatus(PassportStatus objPassportStatus) { objPassportStatus.PassportStatusID = 1; BeginTransaction(); try { objPassportStatus.PassportStatusID = Insert(objPassportStatus); CommitTransaction(); } catch (Exception ex) { RollBackTransaction(); objPassportStatus.PassportStatusID = -1; } return objPassportStatus.PassportStatusID; }
public int DeletePassportStatus(PassportStatus objPassportStatus) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "Status" }; rowsaffected = Update(objPassportStatus, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }
// POST api/passportstatus public PassportStatus Post(PassportStatus passport) { if (passport.GUID > 0) { passport.PassportStatusID = passport.GUID; int rowResult = PassportStatusBO.UpdatePassportStatus(passport); //Return Back to The Client return passport; } else { int rowResult = PassportStatusBO.InsertPassportStatus(passport); //Return Back to The Client return passport; } }
protected void gvPassportStatus_RowCommand(object sender, GridViewCommandEventArgs e) { hfPassportStatusID.Value = e.CommandArgument.ToString(); PassportStatus objPassportStatus = new PassportStatus(); if (e.CommandName.Equals("cmdEdit")) { objPassportStatus = PassportStatusBO.GetPassportStatus(Convert.ToInt32(e.CommandArgument)); txtPassportStatusDesc.Text = objPassportStatus.PassportStatusDesc; } else if (e.CommandName.Equals("cmdDelete")) { int PassportStatusID = Convert.ToInt32(e.CommandArgument); objPassportStatus.PassportStatusID = PassportStatusID; objPassportStatus.Status = 0; PassportStatusBO.DeletePassportStatus(objPassportStatus); loadPassportStatus(); } }
public static int DeletePassportStatus(PassportStatus objPassportStatus) { return new PassportStatusDAO().DeletePassportStatus(objPassportStatus); }
public static int UpdatePassportStatus(PassportStatus objPassportStatus) { return new PassportStatusDAO().UpdatePassportStatus(objPassportStatus); }
public static PassportStatus GetPassportStatus(int PassportStatusID) { PassportStatus objPassportStatus = new PassportStatus(); return (PassportStatus)(new PassportStatusDAO().FillDTO(objPassportStatus, "PassportStatusID=" + PassportStatusID)); }
public static int InsertPassportStatus(PassportStatus objPassportStatus) { return new PassportStatusDAO().InsertPassportStatus(objPassportStatus); }