public static FieldForcePromotion DataRowToObject(DataRow dr)
        {
            FieldForcePromotion TheFieldForcePromotion = new FieldForcePromotion();

            TheFieldForcePromotion.FieldForcePromotionID     = int.Parse(dr["FieldForcePromotionID"].ToString());
            TheFieldForcePromotion.FieldForceID              = int.Parse(dr["FieldForceID"].ToString());
            TheFieldForcePromotion.FieldForceName            = dr["FieldForceName"].ToString();
            TheFieldForcePromotion.FieldForceCode            = dr["FieldForceCode"].ToString();
            TheFieldForcePromotion.BusinessFromDate          = DateTime.Parse(dr["BusinessFromDate"].ToString()).ToString(MicroConstants.DateFormat);
            TheFieldForcePromotion.BusinessToDate            = DateTime.Parse(dr["BusinessToDate"].ToString()).ToString(MicroConstants.DateFormat);
            TheFieldForcePromotion.BusinessNew               = decimal.Parse(dr["BusinessNew"].ToString());
            TheFieldForcePromotion.BusinessRenew             = decimal.Parse(dr["BusinessRenew"].ToString());
            TheFieldForcePromotion.BusinessOneTime           = decimal.Parse(dr["BusinessOneTime"].ToString());
            TheFieldForcePromotion.ExistingRankID            = int.Parse(dr["ExistingRankID"].ToString());
            TheFieldForcePromotion.ExistingRankDescription   = dr["ExistingRankDescription"].ToString();
            TheFieldForcePromotion.PromotedToRankID          = int.Parse(dr["PromotedToRankID"].ToString());
            TheFieldForcePromotion.PromotedToRankDescription = dr["PromotedToRankDescription"].ToString();
            TheFieldForcePromotion.PromotionStatus           = dr["PromotionStatus"].ToString();
            TheFieldForcePromotion.HasAccepted               = bool.Parse(dr["HasAccepted"].ToString());
            if (!string.IsNullOrEmpty(dr["StatusChangeDate"].ToString()))
            {
                TheFieldForcePromotion.StatusChangeDate = DateTime.Parse(dr["StatusChangeDate"].ToString()).ToString(MicroConstants.DateFormat);
            }
            TheFieldForcePromotion.StatusChangedByEmployeeID = int.Parse(MicroGlobals.ReturnZeroIfNull(dr["StatusChangedByEmployeeID"].ToString()));
            TheFieldForcePromotion.Remarks  = dr["Remarks"].ToString();
            TheFieldForcePromotion.OfficeID = int.Parse(dr["OfficeID"].ToString());

            return(TheFieldForcePromotion);
        }
        public static FieldForcePromotion GetFieldForcePromotionByID(int FieldForcePromotionID)
        {
            DataRow TheFieldForcePromotionRow = FieldForcePromotionDataAccess.GetInstance.GetFieldForcePromotionByID(FieldForcePromotionID);

            FieldForcePromotion TheFieldForcePromotion = DataRowToObject(TheFieldForcePromotionRow);

            return(TheFieldForcePromotion);
        }
        public static List <FieldForcePromotion> GetFieldForcePromotionList(string FromDate, string ToDate, bool allOffices = false, bool showDeleted = false)
        {
            List <FieldForcePromotion> FieldForcePromotionList = new List <FieldForcePromotion>();
            DataTable FieldForcePromotionTable = FieldForcePromotionDataAccess.GetInstance.GetFieldForcePromotionList(FromDate, ToDate);

            foreach (DataRow dr in FieldForcePromotionTable.Rows)
            {
                FieldForcePromotion TheFieldForcePromotion = DataRowToObject(dr);

                FieldForcePromotionList.Add(TheFieldForcePromotion);
            }

            return(FieldForcePromotionList);
        }
        public int RejectFieldForcePromote(FieldForcePromotion theFieldForcePromotion)
        {
            int ReturnValue = 0;

            using (SqlCommand UpdateCommand = new SqlCommand())
            {
                UpdateCommand.CommandType = CommandType.StoredProcedure;
                UpdateCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;
                UpdateCommand.Parameters.Add(GetParameter("@FieldForcePromotionID", SqlDbType.Int, theFieldForcePromotion.FieldForcePromotionID));
                UpdateCommand.Parameters.Add(GetParameter("@HasAccepted", SqlDbType.Bit, theFieldForcePromotion.HasAccepted));
                UpdateCommand.Parameters.Add(GetParameter("@RejectedBy", SqlDbType.Int, theFieldForcePromotion.RejectedBy));
                UpdateCommand.Parameters.Add(GetParameter("@ReasonOfRejection", SqlDbType.VarChar, theFieldForcePromotion.Remarks));
                UpdateCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));
                UpdateCommand.CommandText = "pCRM_FieldForcePromotions_Reject";

                ExecuteStoredProcedure(UpdateCommand);
                ReturnValue = int.Parse(UpdateCommand.Parameters[0].Value.ToString());

                return(ReturnValue);
            }
        }
 public static int RejectFieldForcePromote(FieldForcePromotion theFieldForcePromotion)
 {
     return(FieldForcePromotionDataAccess.GetInstance.RejectFieldForcePromote(theFieldForcePromotion));
 }
 public int RejectFieldForcePromote(FieldForcePromotion theFieldForcePromotion)
 {
     return(FieldForcePromotionIntegration.RejectFieldForcePromote(theFieldForcePromotion));
 }