public bool InsertPaypalTransactionData(string guid, string paymentid, long ApplicationID)
        {
            bool       IsSuccessful;
            SqlCommand cmd;

            try
            {
                _sqlConnService.OpenConnection();
                cmd             = new SqlCommand("SP_SaveDeletePaypalTransaction", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ID", Guid.NewGuid());
                cmd.Parameters.AddWithValue("@GUID", guid);
                cmd.Parameters.AddWithValue("@PAYMENTID", paymentid);
                cmd.Parameters.AddWithValue("@APPID", ApplicationID);
                cmd.Parameters.AddWithValue("@STATEMENT_TYPE", "INSERT");
                cmd.ExecuteNonQuery();
                IsSuccessful = true;
            }
            catch (Exception ex)
            {
                IsSuccessful = false;
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(IsSuccessful);
        }
        public List <TranslationCertificateSettingsModel> GetTranslationCertificateSettingsList(BaseViewModel model)
        {
            SqlCommand    cmd;
            SqlDataReader Reader;
            TranslationCertificateSettingsModel        SettingsModel;
            List <TranslationCertificateSettingsModel> SettingsList = new List <TranslationCertificateSettingsModel>();

            _sqlConnService.OpenConnection();
            try
            {
                cmd             = new SqlCommand("SP_GetAllTranslationCertificateSettings", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                Reader          = cmd.ExecuteReader();
                while (Reader.Read() == true)
                {
                    SettingsModel    = new TranslationCertificateSettingsModel();
                    SettingsModel.ID = Convert.ToInt64(Reader["ID"].ToString());
                    SettingsModel.CertificateType = (CertificateType)Convert.ToInt32(Reader["CertificateType"].ToString());
                    SettingsModel.UnitPrice       = Convert.ToInt64(Reader["UnitPrice"].ToString());
                    SettingsList.Add(SettingsModel);
                }
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "Transcription Estimation Input", message);
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(SettingsList);
        }
Ejemplo n.º 3
0
        public List <StaffPaymentModel> GetStaffPaymentList(BaseViewModel model)
        {
            List <StaffPaymentModel> staffPaymentList = new List <StaffPaymentModel>();

            try
            {
                StaffPaymentModel staffpayment;

                _sqlConnService.OpenConnection();
                SqlCommand command = new SqlCommand("SP_GetStaffPayment", _sqlConnService.CreateConnection());
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@CultureId", model.CurrentCulture);
                command.Parameters.AddWithValue("@STAFFNO", DBNull.Value);
                SqlDataReader dr = command.ExecuteReader();
                while (dr.Read())
                {
                    staffpayment = new StaffPaymentModel();

                    //  staffpayment.Number = dr["Number"].ToString();
                    staffpayment.Name = dr["Name"].ToString();
                    // staffpayment.TradingCorporationID = Convert.ToInt32(dr["TradingCorporationID"].ToString());
                    //   staffpayment.TradingCorporation = dr["TradingCorporation"].ToString();
                    staffpayment.DepositeType = dr["DepositeType"].ToString();
                    if (dr["AccountTypeID"] != DBNull.Value)
                    {
                        staffpayment.DepositeTypeId = Convert.ToInt64(dr["AccountTypeID"].ToString());
                    }

                    staffpayment.Bank = dr["Bank"].ToString();

                    staffpayment.BankId        = dr["BankId"] != DBNull.Value? Guid.Parse(dr["BankId"].ToString()): Guid.Empty;
                    staffpayment.Branch        = dr["Branch"].ToString();
                    staffpayment.BranchId      = dr["BankBranchID"] != DBNull.Value? Guid.Parse(dr["BankBranchID"].ToString()):Guid.Empty;
                    staffpayment.AccountNumber = dr["AccountNumber"].ToString();
                    staffpayment.AccountHolder = dr["AccountHolder"].ToString();
                    // staffpayment.RemittableAmount = decimal.Parse(dr["RemittableAmount"].ToString());
                    //  staffpayment.Carryover = decimal.Parse(dr["Carryover"].ToString());
                    //  staffpayment.LastAdjustmentAmount = decimal.Parse(dr["LastAdjustmentAmount"].ToString());
                    //   staffpayment.ScheduledRemittanceAmount = decimal.Parse(dr["ScheduledRemittanceAmount"].ToString());
                    //  staffpayment.StaffBurdenFee = decimal.Parse(dr["StaffBurdenFee"].ToString());
                    //   staffpayment.BcauseBurdenFee = decimal.Parse(dr["BcauseBurdenFee"].ToString());
                    //   staffpayment.StaffTransferAmount = decimal.Parse(dr["StaffTransferAmount"].ToString());
                    //   staffpayment.BcauseTransferAmount = decimal.Parse(dr["BcauseTransferAmount"].ToString());
                    //   staffpayment.MoneyTransfer = decimal.Parse(dr["MoneyTransfer"].ToString());
                    //   staffpayment.RemittanceDate = Convert.ToDateTime(dr["RemittanceDate"].ToString());
                    //  staffpayment.RemittedAmount = decimal.Parse(dr["RemittedAmount"].ToString());
                    //   staffpayment.AdjustmentAmount = decimal.Parse(dr["AdjustmentAmount"].ToString());
                    //   staffpayment.Notes = dr["Notes"].ToString();
                    staffpayment.Email = dr["Email"].ToString();

                    staffPaymentList.Add(staffpayment);
                }
                _sqlConnService.CloseConnection();
            }
            catch (Exception ex) { }
            return(staffPaymentList);
        }
        /*******************************************************************************************************************************
        * *****************************************************************************************************************************
        * *****************************************************************************************************************************
        * *****************************************************************************************************************************/


        public List <TransproLanguagePriceCategoryModel> DeleteTransproLanguagePriceCategory(TransproLanguagePriceCategoryModel PriceCategoryModel)
        {
            SqlCommand cmd;

            try
            {
                _sqlConnService.OpenConnection();

                cmd             = new SqlCommand("SP_SaveDeleteTransproLanguagePriceDetails", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@PriceCategoryID", PriceCategoryModel.ID);
                cmd.Parameters.AddWithValue("@StatementType", "DeleteByPriceCategoryID");
                cmd.ExecuteNonQuery();

                cmd             = new SqlCommand("SP_SaveDeleteTransproLanguagePriceCategory", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ID", PriceCategoryModel.ID);
                cmd.Parameters.AddWithValue("@StatementType", "Delete");
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(PriceCategoryModel.CurrentUserID, "Transpro", message);
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }

            TransproLanguagePriceCategoryQueryModel BaseModel = new TransproLanguagePriceCategoryQueryModel();

            BaseModel.CurrentCulture = PriceCategoryModel.CurrentCulture;
            BaseModel.CurrentUserID  = PriceCategoryModel.CurrentUserID;
            return(this.GetTransproLanguagePriceCategoryList(BaseModel));
        }
        public bool SaveEstimation(EstimationModel model)
        {
            SqlCommand cmd, cmd2, cmd3;
            bool       isSuccessful = false;
            Guid       EstimationID;

            try
            {
                _sqlConnService.OpenConnection();
                cmd             = new SqlCommand("SP_SaveEstimation", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;

                string EstimationNumber = GenerateEstimationNumber(model);
                cmd.Parameters.AddWithValue("@InquiryDate", model.InquiryDate);
                cmd.Parameters.AddWithValue("@ApplicationID", model.ApplicationId);
                cmd.Parameters.AddWithValue("@EstimationRouteID", model.EstimateRouteID);
                cmd.Parameters.AddWithValue("@OutwardSalesID", model.OutwardSalesID);
                cmd.Parameters.AddWithValue("@LargeSalesID", model.LargeSalesID);
                cmd.Parameters.AddWithValue("@SalesPersonID", model.SalesPersonID);
                cmd.Parameters.AddWithValue("@AssistantID", model.AssistantID);
                cmd.Parameters.AddWithValue("@CoordinatorID", model.CoordinatorID);
                cmd.Parameters.AddWithValue("@ApprovalID", model.ApprovalID);
                cmd.Parameters.AddWithValue("@ClientID", model.ClientID);
                cmd.Parameters.AddWithValue("@TradingID", model.TradingID);
                cmd.Parameters.AddWithValue("@TeamID", model.TeamID);
                cmd.Parameters.AddWithValue("@IsCompanyPrivate", model.IsCompanyPrivate);
                cmd.Parameters.AddWithValue("@ClientStatus", model.ClientStatus);
                cmd.Parameters.AddWithValue("@SubSpecializedFieldID", model.SubSpecializedFieldID);
                cmd.Parameters.AddWithValue("@ClientDepartmentID", model.ClientDepartmentID);
                cmd.Parameters.AddWithValue("@BusinessCategoryID", model.BusinessCategoryID);
                cmd.Parameters.AddWithValue("@ClientPersonInCharge", model.ClientPersonInCharge);
                cmd.Parameters.AddWithValue("@ClientEmailCC", model.ClientEmailCC);
                cmd.Parameters.AddWithValue("@ClientAddress_" + model.CurrentCulture, model.ClientAddress);
                cmd.Parameters.AddWithValue("@ClientContactNo", model.ClientContactNo);
                cmd.Parameters.AddWithValue("@ClientFax", model.ClientFax);
                cmd.Parameters.AddWithValue("@BillingCompanyName_" + model.CurrentCulture, model.BillingCompanyName);
                cmd.Parameters.AddWithValue("@BillingTo", model.BillingTo);
                cmd.Parameters.AddWithValue("@BillingEmailCC", model.BillingEmailCC);
                cmd.Parameters.AddWithValue("@BillingAddress_" + model.CurrentCulture, model.BillingAddress);
                cmd.Parameters.AddWithValue("@BillingContactNo", model.BillingContactNo);
                cmd.Parameters.AddWithValue("@BillingFax", model.BillingFax);
                cmd.Parameters.AddWithValue("@IsPostingBill", model.IsPostingBill);
                cmd.Parameters.AddWithValue("@PaymentTerms", model.PaymentTerms);
                cmd.Parameters.AddWithValue("@DeliveryCompanyName_" + model.CurrentCulture, model.DeliveryCompanyName);
                cmd.Parameters.AddWithValue("@DeliveryTo", model.DeliveryTo);
                cmd.Parameters.AddWithValue("@DeliveryEmailCC", model.DeliveryEmailCC);
                cmd.Parameters.AddWithValue("@DeliveryAddress_" + model.CurrentCulture, model.DeliveryAddress);
                cmd.Parameters.AddWithValue("@DeliveryContactNo", model.DeliveryContactNo);
                cmd.Parameters.AddWithValue("@DeliveryFax", model.DeliveryFax);
                cmd.Parameters.AddWithValue("@DeliveryInstruction", model.DeliveryInstruction);
                cmd.Parameters.AddWithValue("@RemarksCoordinatorType", model.RemarksCoordinatorType);
                cmd.Parameters.AddWithValue("@CurrencyID", model.CurrencyID);
                cmd.Parameters.AddWithValue("@IsProspect", model.IsProspect);
                cmd.Parameters.AddWithValue("@IsUndisclosed", model.IsUndisclosed);
                cmd.Parameters.AddWithValue("@EstimationType", model.EstimationType);
                //cmd.Parameters.AddWithValue("@EstimationStatus", model.EstimationStatus);
                cmd.Parameters.AddWithValue("@SpecializedFieldID", model.SpecializedFieldID);
                cmd.Parameters.AddWithValue("@IsInternalPurpose", model.IsInternalPurpose);
                cmd.Parameters.AddWithValue("@IsExternalPurpose", model.IsExternalPurpose);
                cmd.Parameters.AddWithValue("@IsPrintPurpose", model.IsPrintPurpose);
                cmd.Parameters.AddWithValue("@IsWebPurpose", model.IsWebPurpose);
                cmd.Parameters.AddWithValue("@IsOtherPurpose", model.IsOtherPurpose);
                cmd.Parameters.AddWithValue("@OtherPurposeText", model.OtherPurposeText);
                cmd.Parameters.AddWithValue("@PriorityQuality", model.PriorityQuality);
                cmd.Parameters.AddWithValue("@PriorityPrice", model.PriorityPrice);
                cmd.Parameters.AddWithValue("@PriorityDelivery", model.PriorityDelivery);
                cmd.Parameters.AddWithValue("@PriorityTender", model.PriorityTender);
                cmd.Parameters.AddWithValue("@KnownByGoogle", model.KnownByGoogle);
                cmd.Parameters.AddWithValue("@KnownByYahoo", model.KnownByYahoo);
                cmd.Parameters.AddWithValue("@KnownByEmail", model.KnownByEmail);
                cmd.Parameters.AddWithValue("@KnownByBing", model.KnownByBing);
                cmd.Parameters.AddWithValue("@KnownByOthers", model.KnownByOthers);
                cmd.Parameters.AddWithValue("@KnownOtherText", model.KnownOtherText);
                cmd.Parameters.AddWithValue("@FinalDeliveryDate", model.FinalDeliveryDate);
                cmd.Parameters.AddWithValue("@FirstDeliveryDate", model.FirstDeliveryDate);
                cmd.Parameters.AddWithValue("@CoordinatorNotes_" + model.CurrentCulture, model.CoordinatorNotes);
                cmd.Parameters.AddWithValue("@Remarks_" + model.CurrentCulture, model.Remarks);
                cmd.Parameters.AddWithValue("@IsRemarksHideInPDF", model.IsRemarksHideInPDF);
                cmd.Parameters.AddWithValue("@IsOrderReceived", model.IsOrderReceived);
                cmd.Parameters.AddWithValue("@DiscountTotal", model.DiscountTotal);
                cmd.Parameters.AddWithValue("@AverageUnitPrice", model.AverageUnitPrice);
                cmd.Parameters.AddWithValue("@ActualUnitPrice", model.ActualUnitPrice);
                cmd.Parameters.AddWithValue("@IsDeleted", model.IsDeleted);
                cmd.Parameters.AddWithValue("@PurposeDetails", model.PurposeDetails);
                cmd.Parameters.AddWithValue("@OrderTitle", model.OrderTitle);
                cmd.Parameters.AddWithValue("@IssuedByTranslator", model.IssuedByTranslator);
                cmd.Parameters.AddWithValue("@IssuedByCompany", model.IssuedByCompany);
                cmd.Parameters.AddWithValue("@PriceCertification", model.PriceCertification);
                cmd.Parameters.AddWithValue("@OtherItemName_" + model.CurrentCulture, model.OtherItemName);
                cmd.Parameters.AddWithValue("@OtherItemUnitPrice", model.OtherItemUnitPrice);
                cmd.Parameters.AddWithValue("@OtherItemNumber", model.OtherItemNumber);
                cmd.Parameters.AddWithValue("@OtherAmount", model.OtherAmount);
                cmd.Parameters.AddWithValue("@TaxEstimation", model.TaxEstimation);
                cmd.Parameters.AddWithValue("@QuotationInclTax", model.QuotationInclTax);
                cmd.Parameters.AddWithValue("@QuotationExclTax", model.QuotationExclTax);
                cmd.Parameters.AddWithValue("@ConsumptionOnTax", model.ConsumptionOnTax);
                cmd.Parameters.AddWithValue("@ExcludedTaxCost", model.ExcludedTaxCost);
                cmd.Parameters.AddWithValue("@IsCampaign", model.IsCampaign);
                cmd.Parameters.AddWithValue("@IsSpecialPrice", model.IsSpecialPrice);
                cmd.Parameters.AddWithValue("@IsSpecialDeal", model.IsSpecialDeal);
                cmd.Parameters.AddWithValue("@IsPromotion", model.IsPromotion);
                cmd.Parameters.AddWithValue("@IsSpecialPayment", model.IsSpecialPayment);
                cmd.Parameters.AddWithValue("@IsPastComplaint", model.IsPastComplaint);
                cmd.Parameters.AddWithValue("@IsExpertise", model.IsExpertise);
                cmd.Parameters.AddWithValue("@IsOnGoingTask", model.IsOnGoingTask);
                cmd.Parameters.AddWithValue("@IsOverSeas", model.IsOverseas);
                cmd.Parameters.AddWithValue("@IsJapan", model.IsJapan);
                cmd.Parameters.AddWithValue("@CountryID", model.CountryID);
                cmd.Parameters.AddWithValue("@KnownByIntroduction", model.KnownByIntroduction);
                cmd.Parameters.AddWithValue("@KnownIntroductionText", model.KnownIntroductionText);
                cmd.Parameters.AddWithValue("@AttachedMaterialFileName", model.AttachedMaterialFileName);
                cmd.Parameters.AddWithValue("@AttachedMaterialDownloadURL", model.AttachedMaterialDownloadURL);
                cmd.Parameters.AddWithValue("@IsContentAll", model.IsContentAll);
                cmd.Parameters.AddWithValue("@IsPerformance", model.IsPerformance);
                cmd.Parameters.AddWithValue("@IsAccuracy", model.IsAccuracy);
                cmd.Parameters.AddWithValue("@IsLocal", model.IsLocal);
                cmd.Parameters.AddWithValue("@QuotationNotes_" + model.CurrentCulture, model.QuotationNotes);
                cmd.Parameters.AddWithValue("@StartDate", model.StartDate);
                cmd.Parameters.AddWithValue("@EndDate", model.EndDate);
                cmd.Parameters.AddWithValue("@UnitID", model.UnitID);
                cmd.Parameters.AddWithValue("@CreatedBy", model.CurrentUserID);

                if (model.ID == Guid.Empty)
                {
                    EstimationID = Guid.NewGuid();
                    cmd.Parameters.AddWithValue("@ID", EstimationID);
                    cmd.Parameters.AddWithValue("@EstimationNo", EstimationNumber);
                    cmd.Parameters.AddWithValue("@RegistrationDate", DateTime.Now);
                    cmd.Parameters.AddWithValue("@StatementType", "Insert");
                }
                else
                {
                    EstimationID = model.ID;
                    cmd.Parameters.AddWithValue("@ID", EstimationID);
                    cmd.Parameters.AddWithValue("@EstimationNo", model.EstimationNo);
                    cmd.Parameters.AddWithValue("@RegistrationDate", model.RegistrationDate);
                    cmd.Parameters.AddWithValue("@StatementType", "Update");
                }
                cmd.ExecuteNonQuery();              // Run stored procedure to store Estimation on database

                foreach (EstimationDetailsModel DetailsModel in model.EstimationItems)
                {
                    Guid EstimationDetailsID;
                    DetailsModel.StartTime  = DetailsModel.NewStartTime;
                    DetailsModel.FinishTime = DetailsModel.NewFinishTime;

                    cmd2             = new SqlCommand("SP_SaveEstimationDetails", _sqlConnService.CreateConnection());
                    cmd2.CommandType = CommandType.StoredProcedure;
                    cmd2.Parameters.AddWithValue("@EstimationID", EstimationID);
                    cmd2.Parameters.AddWithValue("@SourceLanguageID", DetailsModel.SourceLanguageID);
                    cmd2.Parameters.AddWithValue("@TargetLanguageID", DetailsModel.TargetLanguageID);
                    cmd2.Parameters.AddWithValue("@ServiceType", DetailsModel.ServiceType);
                    cmd2.Parameters.AddWithValue("@UnitPrice1", DetailsModel.UnitPrice1);
                    cmd2.Parameters.AddWithValue("@UnitPrice2", DetailsModel.UnitPrice2);
                    cmd2.Parameters.AddWithValue("@UnitPrice3", DetailsModel.UnitPrice3);
                    cmd2.Parameters.AddWithValue("@UnitPrice4", DetailsModel.UnitPrice4);
                    cmd2.Parameters.AddWithValue("@UnitPrice5", DetailsModel.UnitPrice5);
                    cmd2.Parameters.AddWithValue("@Discount1", DetailsModel.Discount1);
                    cmd2.Parameters.AddWithValue("@Discount2", DetailsModel.Discount2);
                    cmd2.Parameters.AddWithValue("@Discount3", DetailsModel.Discount3);
                    cmd2.Parameters.AddWithValue("@Discount4", DetailsModel.Discount4);
                    cmd2.Parameters.AddWithValue("@Discount5", DetailsModel.Discount5);
                    cmd2.Parameters.AddWithValue("@PageCount1", DetailsModel.PageCount1);
                    cmd2.Parameters.AddWithValue("@PageCount2", DetailsModel.PageCount2);
                    cmd2.Parameters.AddWithValue("@PageCount3", DetailsModel.PageCount3);
                    cmd2.Parameters.AddWithValue("@PageCount4", DetailsModel.PageCount4);
                    cmd2.Parameters.AddWithValue("@PageCount5", DetailsModel.PageCount5);
                    cmd2.Parameters.AddWithValue("@BasicTime", DetailsModel.BasicTime);
                    cmd2.Parameters.AddWithValue("@AdditionalBasicAmount", DetailsModel.AdditionalBasicAmount);
                    cmd2.Parameters.AddWithValue("@AdditionalTime", DetailsModel.AdditionalTime);
                    cmd2.Parameters.AddWithValue("@ExtensionTime", DetailsModel.ExtensionTime);
                    cmd2.Parameters.AddWithValue("@ExtraTime", DetailsModel.ExtraTime);
                    cmd2.Parameters.AddWithValue("@LateNightTime", DetailsModel.LateNightTime);
                    cmd2.Parameters.AddWithValue("@TransferTime", DetailsModel.TransferTime);
                    cmd2.Parameters.AddWithValue("@BasicAmount", DetailsModel.BasicAmount);
                    cmd2.Parameters.AddWithValue("@ExtensionAmount", DetailsModel.ExtensionAmount);
                    cmd2.Parameters.AddWithValue("@ExtraAmount", DetailsModel.ExtraAmount);
                    cmd2.Parameters.AddWithValue("@LateAtNightAmount", DetailsModel.LateAtNightAmount);
                    cmd2.Parameters.AddWithValue("@TransferAmount", DetailsModel.TransferAmount);
                    cmd2.Parameters.AddWithValue("@NumberOfDays", DetailsModel.NumberOfDays);
                    cmd2.Parameters.AddWithValue("@NumberOfPeople", DetailsModel.NumberOfPeople);
                    cmd2.Parameters.AddWithValue("@OtherAmount", DetailsModel.OtherAmount);
                    cmd2.Parameters.AddWithValue("@CertificateAmount", DetailsModel.CertificateAmount);
                    cmd2.Parameters.AddWithValue("@ExcludeTax", DetailsModel.ExcludeTax);
                    cmd2.Parameters.AddWithValue("@LengthMinute", DetailsModel.LengthMinute);
                    cmd2.Parameters.AddWithValue("@WithTranslation", DetailsModel.WithTranslation);
                    cmd2.Parameters.AddWithValue("@StartDate", DetailsModel.StartDate);
                    cmd2.Parameters.AddWithValue("@CompletionDate", DetailsModel.CompletionDate);
                    cmd2.Parameters.AddWithValue("@StartTime", DetailsModel.StartTime);
                    cmd2.Parameters.AddWithValue("@FinishTime", DetailsModel.FinishTime);
                    cmd2.Parameters.AddWithValue("@Contents", DetailsModel.Contents);
                    cmd2.Parameters.AddWithValue("@IsOverseas", DetailsModel.IsOverseas);
                    cmd2.Parameters.AddWithValue("@Total", DetailsModel.Total);
                    cmd2.Parameters.AddWithValue("@TotalAfterDiscount", DetailsModel.TotalAfterDiscount);
                    cmd2.Parameters.AddWithValue("@DiscountedPrice", DetailsModel.DiscountedPrice);
                    cmd2.Parameters.AddWithValue("@DiscountRate", DetailsModel.DiscountRate);
                    cmd2.Parameters.AddWithValue("@UnitPriceSubTotal", DetailsModel.UnitPriceSubTotal);
                    cmd2.Parameters.AddWithValue("@PaymentRate", DetailsModel.PaymentRate);
                    cmd2.Parameters.AddWithValue("@ExpectedPayment", DetailsModel.ExpectedPayment);



                    if (DetailsModel.IsMarkedForDelete == true)
                    {
                        EstimationDetailsID = Guid.Empty;
                        cmd2.Parameters.AddWithValue("@ID", DetailsModel.ID);
                        cmd2.Parameters.AddWithValue("@StatementType", "Delete");
                    }
                    else if (DetailsModel.ID == Guid.Empty)
                    {
                        EstimationDetailsID = Guid.NewGuid();
                        cmd2.Parameters.AddWithValue("@ID", EstimationDetailsID);
                        cmd2.Parameters.AddWithValue("@StatementType", "Insert");
                    }
                    else
                    {
                        EstimationDetailsID = DetailsModel.ID;
                        cmd2.Parameters.AddWithValue("@ID", EstimationDetailsID);
                        cmd2.Parameters.AddWithValue("@StatementType", "Update");
                    }
                    cmd2.ExecuteNonQuery();             // Run stored procedure to store EstimationDetails on database
                    if (DetailsModel.IsMarkedForDelete == true)
                    {
                        goto LOOP_END;
                    }

                    isSuccessful = true;
                    LOOP_END :;
                }

                foreach (OrderStaffAllowanceModel collection in model.CollectionFee)
                {
                    if (collection.SubTotal > 0 || collection.IsMarkedForDelete == true)
                    {
                        Guid AllowanceID;
                        cmd3             = new SqlCommand("SP_SaveOrderStaffAllowance", _sqlConnService.CreateConnection());
                        cmd3.CommandType = CommandType.StoredProcedure;
                        cmd3.Parameters.AddWithValue("@ItemName", collection.ItemName);
                        cmd3.Parameters.AddWithValue("@UnitPrice", collection.UnitPrice);
                        cmd3.Parameters.AddWithValue("@NoOfPersons", collection.NoOfPersons);
                        cmd3.Parameters.AddWithValue("@NoOfDays", collection.NoOfDays);
                        cmd3.Parameters.AddWithValue("@SubTotal", collection.SubTotal);
                        cmd3.Parameters.AddWithValue("@AllowanceType", collection.AllowanceType);
                        cmd3.Parameters.AddWithValue("@IsCompleteSet", collection.IsCompleteSet);
                        cmd3.Parameters.AddWithValue("@IsExclTax", collection.IsExclTax);

                        if (collection.IsMarkedForDelete == true)
                        {
                            //Delete the record
                            cmd3.Parameters.AddWithValue("@ID", collection.ID);
                            cmd3.Parameters.AddWithValue("@StatementType", "Delete");
                        }
                        else if (collection.EstimationID == Guid.Empty)
                        {
                            // Insert the record
                            collection.EstimationID = EstimationID;
                            AllowanceID             = Guid.NewGuid();
                            collection.ID           = AllowanceID;
                            cmd3.Parameters.AddWithValue("@ID", collection.ID);
                            cmd3.Parameters.AddWithValue("@EstimationID", collection.EstimationID);
                            cmd3.Parameters.AddWithValue("@StatementType", "Insert");
                        }
                        else
                        {
                            // Update the record
                            cmd3.Parameters.AddWithValue("@ID", collection.ID);
                            cmd3.Parameters.AddWithValue("@EstimationID", collection.EstimationID);
                            cmd3.Parameters.AddWithValue("@StatementType", "Update");
                        }

                        cmd3.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                isSuccessful = false;
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "Estimation", message);
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(isSuccessful);
        }
Ejemplo n.º 6
0
        public List <UserInfoModel> GetSearchUserList(BaseViewModel model, string con)
        {
            List <UserInfoModel> userInfoList = new List <UserInfoModel>();
            UserInfoModel        userInfoModel;

            try
            {
                string branch = con.Split(',')[0];
                string type   = con.Split(',')[1];
                string eid    = con.Split(',')[2];
                string resign = con.Split(',')[3];
                string role   = con.Split(',')[4];
                string author = con.Split(',')[5];
                string ename  = con.Split(',')[6];
                _sqlConnService.OpenConnection();
                SqlCommand command = new SqlCommand("SP_GetSearchAllUser", _sqlConnService.CreateConnection());
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@CultureId", model.CurrentCulture);
                if (model.ID == Guid.Empty)
                {
                    command.Parameters.AddWithValue("@ID", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@ID", model.ID);
                }
                command.Parameters.AddWithValue("@EmployeeId", DBNull.Value);
                command.Parameters.AddWithValue("@UserTypeId", DBNull.Value);
                if (branch == "")
                {
                    command.Parameters.AddWithValue("@branch", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@branch", branch);
                }
                if (type == "")
                {
                    command.Parameters.AddWithValue("@type", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@type", type);
                }
                if (eid == "")
                {
                    command.Parameters.AddWithValue("@eid", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@eid", eid);
                }
                if (resign == "")
                {
                    command.Parameters.AddWithValue("@resign", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@resign", resign);
                }
                if (role == "")
                {
                    command.Parameters.AddWithValue("@role", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@role", role);
                }
                if (author == "")
                {
                    command.Parameters.AddWithValue("@author", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@author", author);
                }
                if (ename == "")
                {
                    command.Parameters.AddWithValue("@ename", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@ename", ename);
                }
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    userInfoModel             = new UserInfoModel();
                    userInfoModel.Id          = Convert.ToInt32(reader["ID"].ToString());
                    userInfoModel.FirstName   = reader["FirstName"].ToString();
                    userInfoModel.LastName    = reader["LastName"].ToString();
                    userInfoModel.EmployeeID  = Guid.Parse(reader["EmployeeID"].ToString());
                    userInfoModel.MobileNo    = reader["MobileNo"].ToString();
                    userInfoModel.Email       = reader["Email"].ToString();
                    userInfoModel.Address     = reader["Address"].ToString();
                    userInfoModel.UserTypeId  = Convert.ToInt32(reader["UserTypeId"].ToString());
                    userInfoModel.RoleId      = Convert.ToInt32(reader["RoleId"].ToString());
                    userInfoModel.Username    = reader["Username"].ToString();
                    userInfoModel.Password    = reader["Password"].ToString();
                    userInfoModel.IsActive    = Convert.ToBoolean(reader["Active"].ToString());
                    userInfoModel.CreatedDate = Convert.ToDateTime(reader["CreatedDate"].ToString());
                    userInfoModel.CreatedBy   = Convert.ToInt32(reader["CreatedBy"].ToString());
                    userInfoModel.UpdatedDate = Convert.ToDateTime(reader["UpdatedDate"].ToString());
                    userInfoModel.UpdatedBy   = Convert.ToInt32(reader["UpdatedBy"].ToString());
                    userInfoList.Add(userInfoModel);
                }
                _sqlConnService.CloseConnection();
            }
            catch (Exception ex)
            {
                string message = LogException(ex, model.CurrentUserID);
                throw new Exception(message);
            }
            return(userInfoList);
        }