Beispiel #1
0
        public int ChangeJobStatus(int CompanyID, int JobID, PIKCV.COM.EnumDB.JobStatus NewJobStatus, int CreditsToDecrease, int JobListType, DateTime EndDate, PIKCV.COM.EnumDB.JobStatus CurrentJobStatus)
        {
            PIKCV.DAO.TransactionMgr Tran = PIKCV.DAO.TransactionMgr.ThreadTransactionMgr();

            try
            {
                Tran.BeginTransaction();
                PIKCV.DAL.Jobs obj = new PIKCV.DAL.Jobs();
                obj.LoadByPrimaryKey(JobID);

                if ((CurrentJobStatus == PIKCV.COM.EnumDB.JobStatus.Draft) || (EndDate < DateTime.Now))
                {
                    PIKCV.DAL.Orders objOrders = new PIKCV.DAL.Orders();
                    objOrders.AddNew();
                    objOrders.CompanyID        = CompanyID;
                    objOrders.OrderDate        = DateTime.Now;
                    objOrders.OrderTypeID      = JobListType;
                    objOrders.ProcessTypeCode  = (int)PIKCV.COM.EnumDB.OrderProcessTypeCode.paid;
                    objOrders.IsConfirmed      = true;
                    objOrders.Price            = 0;
                    objOrders.TotalCreditsUsed = CreditsToDecrease;
                    objOrders.Save();
                    int LastOrderID = objOrders.OrderID;

                    PIKCV.DAL.OrderLineItems objOL = new PIKCV.DAL.OrderLineItems();
                    objOL.AddNew();
                    objOL.CreditUsed = CreditsToDecrease;
                    objOL.JobID      = JobID;
                    objOL.OrderID    = LastOrderID;
                    objOL.Price      = 0;
                    objOL.UserID     = 0;
                    objOL.Save();

                    PIKCV.DAL.Companies objCompany = new PIKCV.DAL.Companies();
                    objCompany.LoadByPrimaryKey(CompanyID);
                    objCompany.Credits = objCompany.Credits - CreditsToDecrease;
                    objCompany.Save();

                    obj.StartDate = DateTime.Now;
                    obj.EndDate   = DateTime.Now.AddDays(30);
                }

                obj.JobStatus = (int)NewJobStatus;
                obj.Save();

                Tran.CommitTransaction();

                return(obj.JobID);
            }
            catch (Exception)
            {
                Tran.RollbackTransaction();
                PIKCV.DAO.TransactionMgr.ThreadTransactionMgrReset();
                return(0);
            }
        }
Beispiel #2
0
        //Ýþlemler
        public DataTable GetTransactions(int CompanyID, PIKCV.COM.EnumDB.OrderProcessTypeCode ProcessTypeCode, PIKCV.COM.EnumDB.LanguageID LanguageID, PIKCV.COM.EnumDB.OrderTypeCode OrderTypeCode)
        {
            DataTable dt;

            try
            {
                PIKCV.DAL.Orders obj = new PIKCV.DAL.Orders();
                dt = obj.GetTransactions(CompanyID, (int)ProcessTypeCode, (int)LanguageID, (int)OrderTypeCode);
            }
            catch (Exception)
            {
                dt = null;
                throw;
            }
            return(dt);
        }
Beispiel #3
0
        //Ýþlem Raporlarý
        public DataTable GetTransactionReport(int CompanyID, PIKCV.COM.EnumDB.OrderTypeCode OrderType_CV, PIKCV.COM.EnumDB.OrderTypeCode OrderType_BuyCredit, PIKCV.COM.EnumDB.OrderProcessTypeCode GetTransactionReport, bool IsConfirmed,
                                              PIKCV.COM.EnumDB.LanguageID LanguageID, DateTime OrderStartDate, DateTime OrderEndDate)
        {
            DataTable dt;

            try
            {
                PIKCV.DAL.Orders obj = new PIKCV.DAL.Orders();
                dt = obj.GetTransactionReport(CompanyID, (int)OrderType_CV, (int)OrderType_BuyCredit, (int)GetTransactionReport, IsConfirmed, (int)LanguageID, OrderStartDate, OrderEndDate);
            }
            catch (Exception)
            {
                dt = null;
                throw;
            }
            return(dt);
        }
Beispiel #4
0
        public static DataTable GetOrders(PIKCV.COM.EnumDB.OrderProcessTypeCode OrderProcessTypeCode)
        {
            DataTable dt;

            try
            {
                PIKCV.DAL.Orders objOrders = new PIKCV.DAL.Orders();
                objOrders.Where.ProcessTypeCode.Value = OrderProcessTypeCode;
                objOrders.Query.Load();
                dt = objOrders.DefaultView.ToTable();
            }
            catch (Exception)
            {
                dt = null;
                throw;
            }
            return(dt);
        }
Beispiel #5
0
 //Insert CompanyOwnedUser
 public int InsertOrder(int CompanyID, int OrderTypeID, int ProcessType, int TotalCreditUsed, float Price, bool IsConfirmed, ref PIKCV.DAO.TransactionMgr Tran)
 {
     try
     {
         PIKCV.DAL.Orders objOrder = new PIKCV.DAL.Orders();
         objOrder.AddNew();
         objOrder.CompanyID        = CompanyID;
         objOrder.OrderTypeID      = OrderTypeID;
         objOrder.ProcessTypeCode  = ProcessType;
         objOrder.TotalCreditsUsed = TotalCreditUsed;
         objOrder.Price            = Price;
         objOrder.IsConfirmed      = IsConfirmed;
         objOrder.OrderDate        = DateTime.Now;
         objOrder.Save();
         return(objOrder.OrderID);
     }
     catch (Exception)
     {
         //Tran.RollbackTransaction();
         //PIKCV.DAO.TransactionMgr.ThreadTransactionMgrReset();
         return(0);
     }
 }
Beispiel #6
0
        public int InsertCreditOrders(int CompanyID, int CreditPackageID, int CreditQuantity, double ItemPrice, int OtherPackageQuantity
                                      , double OtherPackagePrice, PIKCV.COM.EnumDB.OrderTypeCode OrderTypeCode, PIKCV.COM.EnumDB.PaymentType PaymentType, bool IsOtherPackage)
        {
            PIKCV.DAO.TransactionMgr Tran = PIKCV.DAO.TransactionMgr.ThreadTransactionMgr();
            Tran.BeginTransaction();
            int TakenCredit = 0;

            try
            {
                if (PaymentType == PIKCV.COM.EnumDB.PaymentType.Loan)
                {
                    double TotalMoney = 0;
                    if (CreditPackageID > 0)
                    {
                        TotalMoney  = CreditQuantity * ItemPrice;
                        TakenCredit = CreditQuantity;
                    }
                    else
                    {
                        TotalMoney  = OtherPackageQuantity * OtherPackagePrice;
                        TakenCredit = OtherPackageQuantity;
                    }
                    PIKCV.DAL.Companies objCompany = new PIKCV.DAL.Companies();
                    objCompany.LoadByPrimaryKey(CompanyID);
                    objCompany.MaxLoan = objCompany.MaxLoan - TotalMoney;
                    objCompany.Credits = objCompany.Credits + TakenCredit;
                    objCompany.Save();
                }
                PIKCV.DAL.CreditOrders objCreditOrders = new PIKCV.DAL.CreditOrders();
                objCreditOrders.AddNew();
                objCreditOrders.CompanyID            = CompanyID;
                objCreditOrders.CreditPackageID      = CreditPackageID;
                objCreditOrders.Quantity             = CreditQuantity;
                objCreditOrders.ItemPrice            = ItemPrice;
                objCreditOrders.OtherPackageQuantity = OtherPackageQuantity;
                objCreditOrders.OtherPackagePrice    = OtherPackagePrice;
                objCreditOrders.OrderDate            = DateTime.Now;
                objCreditOrders.OrderCode            = Util.CreateRandomNumber(12);
                objCreditOrders.OrderTypeID          = (int)OrderTypeCode;
                objCreditOrders.PaymentType          = (int)PaymentType;
                objCreditOrders.Save();

                PIKCV.DAL.Orders objOrder = new PIKCV.DAL.Orders();
                objOrder.AddNew();
                objOrder.CompanyID = CompanyID;
                if (PaymentType == PIKCV.COM.EnumDB.PaymentType.Transfer)
                {
                    objOrder.IsConfirmed     = false;
                    objOrder.ProcessTypeCode = (int)PIKCV.COM.EnumDB.OrderProcessTypeCode.non_invoiced;
                }
                else
                {
                    objOrder.IsConfirmed     = true;
                    objOrder.ProcessTypeCode = (int)PIKCV.COM.EnumDB.OrderProcessTypeCode.unpaid;
                }
                objOrder.OrderDate   = DateTime.Now;
                objOrder.OrderTypeID = (int)OrderTypeCode;
                if (IsOtherPackage)
                {
                    objOrder.Price            = OtherPackageQuantity * OtherPackagePrice;
                    objOrder.TotalCreditsUsed = OtherPackageQuantity;
                }
                else
                {
                    objOrder.Price            = CreditQuantity * ItemPrice;
                    objOrder.TotalCreditsUsed = CreditQuantity;
                }
                objOrder.Save();

                Tran.CommitTransaction();

                return(objCreditOrders.CreditOrderID);
            }
            catch (Exception)
            {
                Tran.RollbackTransaction();
                PIKCV.DAO.TransactionMgr.ThreadTransactionMgrReset();
                return(0);
            }
        }
Beispiel #7
0
        public int SaveApproval(int CompanyID, int JobID, int JobStatus, bool IsCompanyNameHidden, ref int NewCredit)
        {
            PIKCV.DAO.TransactionMgr Tran = PIKCV.DAO.TransactionMgr.ThreadTransactionMgr();

            try
            {
                Tran.BeginTransaction();

                PIKCV.DAL.Jobs obj = new PIKCV.DAL.Jobs();
                obj.LoadByPrimaryKey(JobID);

                if (JobStatus != (int)PIKCV.COM.EnumDB.JobStatus.Draft)
                {
                    //ilanýn pik kredisini þirketten düþelim
                    PIKCV.DAL.OrderTypes objOrderType = new PIKCV.DAL.OrderTypes();
                    objOrderType.LoadByPrimaryKey(obj.JobListType);

                    int CreditsSpend = 0;

                    PIKCV.COM.EnumDB.EmployeeTypes EmployeeTypes = (PIKCV.COM.EnumDB.EmployeeTypes)(obj.UserTypeID);
                    switch (EmployeeTypes)
                    {
                    case PIKCV.COM.EnumDB.EmployeeTypes.Pikpool:
                        CreditsSpend = objOrderType.PikPoolCredit;
                        break;

                    case PIKCV.COM.EnumDB.EmployeeTypes.Goodpik:
                        CreditsSpend = objOrderType.GoodPikCredit;
                        break;
                    }


                    PIKCV.DAL.Companies objCompany = new PIKCV.DAL.Companies();
                    objCompany.LoadByPrimaryKey(CompanyID);

                    NewCredit          = objCompany.Credits - CreditsSpend;
                    objCompany.Credits = NewCredit;
                    objCompany.Save();

                    PIKCV.DAL.Orders objOrders = new PIKCV.DAL.Orders();
                    objOrders.AddNew();
                    objOrders.CompanyID        = CompanyID;
                    objOrders.OrderDate        = DateTime.Now;
                    objOrders.OrderTypeID      = obj.JobListType;
                    objOrders.ProcessTypeCode  = (int)PIKCV.COM.EnumDB.OrderProcessTypeCode.paid;
                    objOrders.IsConfirmed      = true;
                    objOrders.Price            = 0;
                    objOrders.TotalCreditsUsed = CreditsSpend;
                    objOrders.Save();
                    int LastOrderID = objOrders.OrderID;

                    PIKCV.DAL.OrderLineItems objOL = new PIKCV.DAL.OrderLineItems();
                    objOL.AddNew();
                    objOL.CreditUsed = CreditsSpend;
                    objOL.JobID      = JobID;
                    objOL.OrderID    = LastOrderID;
                    objOL.Price      = 0;
                    objOL.UserID     = 0;
                    objOL.Save();

                    //ilanýn pik kredisi düþürüldü þimdi ilaný kaydedelim
                }
                obj.JobStatus           = JobStatus;
                obj.IsCompanyNameHidden = IsCompanyNameHidden;
                obj.ModifyDate          = DateTime.Now;
                obj.Save();

                Tran.CommitTransaction();
                return(obj.JobID);
            }
            catch (Exception)
            {
                Tran.RollbackTransaction();
                PIKCV.DAO.TransactionMgr.ThreadTransactionMgrReset();
                return(0);
            }
        }