Пример #1
0
        Int64 ICRMPaymentScheduleDataAccess.Add(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(cRMPaymentScheduleEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(cRMPaymentScheduleEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        private void GetPaymentScheduleSelectedDropdown()
        {
            CRMPaymentScheduleEntity entity = FCCCRMPaymentSchedule.GetFacadeCreate().GetByID(Int64.Parse(ddlPaymentScheduleID.SelectedValue));

            MiscUtil.PopulateCRMBuyerBasicInfo(ddlBuyerBasicInfoID, false, entity.BuyerBasicInfoID);
            MiscUtil.PopulateBDProjectByCode(ddlProjectID, false, entity.ProjectCode);
            MiscUtil.PopulateBDProjectFloorUnitByBuyerBookSpaceID(ddlProjectFloorUnitID, false, entity.BuyerBookSpaceID);
        }
Пример #3
0
        private Int64 Update(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CRMPaymentSchedule_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);

                Database.AddInParameter(cmd, "@PaymentScheduleID", DbType.Int64, cRMPaymentScheduleEntity.PaymentScheduleID);
                Database.AddInParameter(cmd, "@BuyerBookSpaceID", DbType.Int64, cRMPaymentScheduleEntity.BuyerBookSpaceID);
                Database.AddInParameter(cmd, "@HandoverDate", DbType.DateTime, cRMPaymentScheduleEntity.HandoverDate);
                Database.AddInParameter(cmd, "@ActualHandoverDate", DbType.DateTime, cRMPaymentScheduleEntity.ActualHandoverDate);
                Database.AddInParameter(cmd, "@ProjectCode", DbType.String, cRMPaymentScheduleEntity.ProjectCode);
                Database.AddInParameter(cmd, "@BuyerBasicInfoID", DbType.Int64, cRMPaymentScheduleEntity.BuyerBasicInfoID);
                Database.AddInParameter(cmd, "@TotalAgreementAmount", DbType.Decimal, cRMPaymentScheduleEntity.TotalAgreementAmount);
                Database.AddInParameter(cmd, "@EarnestMoney", DbType.Decimal, cRMPaymentScheduleEntity.EarnestMoney);
                Database.AddInParameter(cmd, "@Reservation", DbType.Decimal, cRMPaymentScheduleEntity.Reservation);
                Database.AddInParameter(cmd, "@CommonService", DbType.Decimal, cRMPaymentScheduleEntity.CommonService);
                Database.AddInParameter(cmd, "@UtilityConnectionCost", DbType.Decimal, cRMPaymentScheduleEntity.UtilityConnectionCost);
                Database.AddInParameter(cmd, "@ReservedFund", DbType.Decimal, cRMPaymentScheduleEntity.ReservedFund);
                Database.AddInParameter(cmd, "@TotalInstallment", DbType.Decimal, cRMPaymentScheduleEntity.TotalInstallment);
                Database.AddInParameter(cmd, "@Remarks", DbType.String, cRMPaymentScheduleEntity.Remarks);
                Database.AddInParameter(cmd, "@CreateByEmployeeID", DbType.Int64, cRMPaymentScheduleEntity.CreateByEmployeeID);
                Database.AddInParameter(cmd, "@IP", DbType.String, cRMPaymentScheduleEntity.IP);
                Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, cRMPaymentScheduleEntity.CreateDate);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("CRMPaymentScheduleEntity already exists. Please specify another CRMPaymentScheduleEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("CRMPaymentScheduleEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("CRMPaymentScheduleEntity already exists. Please specify another CRMPaymentScheduleEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
        protected void lvCRMPaymentSchedule_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 PaymentScheduleID;

            Int64.TryParse(e.CommandArgument.ToString(), out PaymentScheduleID);

            if (PaymentScheduleID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _PaymentScheduleID = PaymentScheduleID;

                    String url = UrlHelper.BuildSecureUrl("~/CRM/CRMPaymentSchedule.aspx",
                                                          string.Empty, "do", "Edit", UrlConstants.OVERVIEW_PAYMENT_SCHEDULE_ID,
                                                          PaymentScheduleID.ToString()).ToString();
                    Response.Redirect(url);
                }

                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMPaymentScheduleEntity.FLD_NAME_PaymentScheduleID, PaymentScheduleID.ToString(), SQLMatchType.Equal);

                        CRMPaymentScheduleEntity cRMPaymentScheduleEntity = new CRMPaymentScheduleEntity();

                        result = FCCCRMPaymentSchedule.GetFacadeCreate().Delete(cRMPaymentScheduleEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _PaymentScheduleID        = 0;
                            _CRMPaymentScheduleEntity = new CRMPaymentScheduleEntity();
                            PrepareInitialView();
                            BindCRMPaymentScheduleList();

                            MiscUtil.ShowMessage(lblMessage, "Payment Schedule has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Payment Schedule.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Пример #5
0
        private Int64 DeleteTran(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CRMPaymentSchedule_SET";

            Database db = DatabaseFactory.CreateDatabase();


            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);


                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode >= 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
Пример #6
0
        private Int64 Delete(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CRMPaymentSchedule_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);


                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("CRMPaymentScheduleEntity already exists. Please specify another CRMPaymentScheduleEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("CRMPaymentScheduleEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("CRMPaymentScheduleEntity already exists. Please specify another CRMPaymentScheduleEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
Пример #7
0
        private Int64 UpdateTran(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CRMPaymentSchedule_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);

                db.AddInParameter(cmd, "@PaymentScheduleID", DbType.Int64, cRMPaymentScheduleEntity.PaymentScheduleID);
                db.AddInParameter(cmd, "@BuyerBookSpaceID", DbType.Int64, cRMPaymentScheduleEntity.BuyerBookSpaceID);
                db.AddInParameter(cmd, "@HandoverDate", DbType.DateTime, cRMPaymentScheduleEntity.HandoverDate);
                db.AddInParameter(cmd, "@ActualHandoverDate", DbType.DateTime, cRMPaymentScheduleEntity.ActualHandoverDate);
                db.AddInParameter(cmd, "@ProjectCode", DbType.String, cRMPaymentScheduleEntity.ProjectCode);
                db.AddInParameter(cmd, "@BuyerBasicInfoID", DbType.Int64, cRMPaymentScheduleEntity.BuyerBasicInfoID);
                db.AddInParameter(cmd, "@TotalAgreementAmount", DbType.Decimal, cRMPaymentScheduleEntity.TotalAgreementAmount);
                db.AddInParameter(cmd, "@EarnestMoney", DbType.Decimal, cRMPaymentScheduleEntity.EarnestMoney);
                db.AddInParameter(cmd, "@Reservation", DbType.Decimal, cRMPaymentScheduleEntity.Reservation);
                db.AddInParameter(cmd, "@CommonService", DbType.Decimal, cRMPaymentScheduleEntity.CommonService);
                db.AddInParameter(cmd, "@UtilityConnectionCost", DbType.Decimal, cRMPaymentScheduleEntity.UtilityConnectionCost);
                db.AddInParameter(cmd, "@ReservedFund", DbType.Decimal, cRMPaymentScheduleEntity.ReservedFund);
                db.AddInParameter(cmd, "@TotalInstallment", DbType.Decimal, cRMPaymentScheduleEntity.TotalInstallment);
                db.AddInParameter(cmd, "@Remarks", DbType.String, cRMPaymentScheduleEntity.Remarks);
                db.AddInParameter(cmd, "@CreateByEmployeeID", DbType.Int64, cRMPaymentScheduleEntity.CreateByEmployeeID);
                db.AddInParameter(cmd, "@IP", DbType.String, cRMPaymentScheduleEntity.IP);
                db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, cRMPaymentScheduleEntity.CreateDate);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
 Int64 ICRMPaymentScheduleFacade.Delete(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateCRMPaymentScheduleDataAccess().Delete(cRMPaymentScheduleEntity, filterExpression, option, reqTran));
 }
 Int64 ICRMPaymentScheduleFacade.Add(CRMPaymentScheduleEntity cRMPaymentScheduleEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateCRMPaymentScheduleDataAccess().Add(cRMPaymentScheduleEntity, option, reqTran));
 }