コード例 #1
0
 private static BOLeaveDetails FillDataRecord(DataRow dr)
 {
     BOLeaveDetails itemObj = new BOLeaveDetails();
       if(dr["LeaveRequestID"] != DBNull.Value)
       itemObj.LeaveRequestID = Int32.Parse(dr["LeaveRequestID"].ToString());
       if(dr["EmployeeID"] != DBNull.Value)
       itemObj.EmployeeID = Int32.Parse(dr["EmployeeID"].ToString());
       if(dr["TotalCasualLeave"] != DBNull.Value)
       itemObj.TotalCasualLeave = Int32.Parse(dr["TotalCasualLeave"].ToString());
       if(dr["TotalSickLeave"] != DBNull.Value)
       itemObj.TotalSickLeave = Int32.Parse(dr["TotalSickLeave"].ToString());
       if(dr["LeaveType"] != DBNull.Value)
       itemObj.LeaveType = Boolean.Parse(dr["LeaveType"].ToString());
       if(dr["IsApproved"] != DBNull.Value)
       itemObj.IsApproved = Boolean.Parse(dr["IsApproved"].ToString());
       if(dr["ApprovedByID"] != DBNull.Value)
       itemObj.ApprovedByID = dr["ApprovedByID"].ToString();
       if(dr["ToDate"] != DBNull.Value)
       itemObj.ToDate = DateTime.Parse(dr["ToDate"].ToString());
       if(dr["FromDate"] != DBNull.Value)
       itemObj.FromDate = DateTime.Parse(dr["FromDate"].ToString());
       if(dr["ApprovedOn"] != DBNull.Value)
       itemObj.ApprovedOn = DateTime.Parse(dr["ApprovedOn"].ToString());
       if(dr["ApprovedDays"] != DBNull.Value)
       itemObj.ApprovedDays = Int32.Parse(dr["ApprovedDays"].ToString());
       if(dr["CreatedOn"] != DBNull.Value)
       itemObj.CreatedOn = DateTime.Parse(dr["CreatedOn"].ToString());
       if(dr["CreatedByID"] != DBNull.Value)
       itemObj.CreatedByID = dr["CreatedByID"].ToString();
       if(dr["ModifiedOn"] != DBNull.Value)
       itemObj.ModifiedOn = DateTime.Parse(dr["ModifiedOn"].ToString());
       if(dr["ModifiedByID"] != DBNull.Value)
       itemObj.ModifiedByID = dr["ModifiedByID"].ToString();
       return itemObj;
 }
コード例 #2
0
        public static int Save(BOLeaveDetails entry, bool adding)
        {
            tblLeaveDetails tblObj = new tblLeaveDetails();
              DataRow newRow = tblObj.Table().NewRow();

              newRow[tblLeaveDetails.LEAVEREQUESTID_FIELD] = entry.LeaveRequestID;
              newRow[tblLeaveDetails.EMPLOYEEID_FIELD] = entry.EmployeeID;
              newRow[tblLeaveDetails.TOTALCASUALLEAVE_FIELD] = entry.TotalCasualLeave;
              newRow[tblLeaveDetails.TOTALSICKLEAVE_FIELD] = entry.TotalSickLeave;
              newRow[tblLeaveDetails.LEAVETYPE_FIELD] = entry.LeaveType;
              newRow[tblLeaveDetails.ISAPPROVED_FIELD] = entry.IsApproved;
              newRow[tblLeaveDetails.APPROVEDBYID_FIELD] = entry.ApprovedByID;
              if(entry.ToDate.Equals(new DateTime()))
                  newRow[tblLeaveDetails.TODATE_FIELD] = DBNull.Value;
              else
                  newRow[tblLeaveDetails.TODATE_FIELD] = entry.ToDate;
              if(entry.FromDate.Equals(new DateTime()))
                  newRow[tblLeaveDetails.FROMDATE_FIELD] = DBNull.Value;
              else
                  newRow[tblLeaveDetails.FROMDATE_FIELD] = entry.FromDate;
              if(entry.ApprovedOn.Equals(new DateTime()))
                  newRow[tblLeaveDetails.APPROVEDON_FIELD] = DBNull.Value;
              else
                  newRow[tblLeaveDetails.APPROVEDON_FIELD] = entry.ApprovedOn;
              newRow[tblLeaveDetails.APPROVEDDAYS_FIELD] = entry.ApprovedDays;
              if(entry.CreatedOn.Equals(new DateTime()))
                  newRow[tblLeaveDetails.CREATEDON_FIELD] = DBNull.Value;
              else
                  newRow[tblLeaveDetails.CREATEDON_FIELD] = entry.CreatedOn;
              newRow[tblLeaveDetails.CREATEDBYID_FIELD] = entry.CreatedByID;
              if(entry.ModifiedOn.Equals(new DateTime()))
                  newRow[tblLeaveDetails.MODIFIEDON_FIELD] = DBNull.Value;
              else
                  newRow[tblLeaveDetails.MODIFIEDON_FIELD] = entry.ModifiedOn;
              newRow[tblLeaveDetails.MODIFIEDBYID_FIELD] = entry.ModifiedByID;

              if(adding)
              return tblObj.AddToTable(newRow);
              else
              return tblObj.UpdateTable(newRow);
        }
コード例 #3
0
 public static int Save(BOLeaveDetails entry)
 {
     return tblLeaveDetailsDBManager.Save(entry, true);
 }
コード例 #4
0
 public static int Update(BOLeaveDetails entry)
 {
     return tblLeaveDetailsDBManager.Save(entry, false);
 }
コード例 #5
0
 public static int Save(BOLeaveDetails entry, bool adding)
 {
     return tblLeaveDetailsDBManager.Save(entry, adding);
 }