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);
        }
예제 #2
0
        public List <StaffListData> GetStaffList(BaseViewModel model)
        {
            SqlCommand    cmd;
            SqlDataReader DataReader;
            TranslationCertificateSettingsModel SettingsModel;
            List <StaffListData> retList = new List <StaffListData>();

            try
            {
                _sqlConnService.OpenConnection();
                cmd             = new SqlCommand("SP_GetStaffList", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                DataReader      = cmd.ExecuteReader();
                while (DataReader.Read() == true)
                {
                    StaffListData retVal = new StaffListData();
                    if (!string.IsNullOrEmpty(DataReader["StaffNo"].ToString()))
                    {
                        retVal.StaffNo = (DataReader["StaffNo"].ToString());
                    }
                    if (!string.IsNullOrEmpty(DataReader["Name"].ToString()))
                    {
                        retVal.Name = (DataReader["Name"].ToString());
                    }
                    if (!string.IsNullOrEmpty(DataReader["BirthDate"].ToString()))
                    {
                        retVal.BirthDate = Convert.ToDateTime(DataReader["BirthDate"]);
                    }
                    if (!string.IsNullOrEmpty(DataReader["Gender"].ToString()))
                    {
                        retVal.Gender = DataReader["Gender"].ToString();
                    }
                    if (!string.IsNullOrEmpty(DataReader["PostalCode"].ToString()))
                    {
                        retVal.PostalCode = DataReader["PostalCode"].ToString();
                    }
                    if (!string.IsNullOrEmpty(DataReader["LivingCountry"].ToString()))
                    {
                        retVal.LivingCountry = DataReader["LivingCountry"].ToString();
                    }
                    retList.Add(retVal);
                }
                DataReader.Close();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "StaffListService", message);
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(retList);
        }
        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);
        }
예제 #4
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);
        }
예제 #5
0
        public List <AgentBusinessModel> GetAllAgentBusinessList(BaseViewModel model)
        {
            List <AgentBusinessModel> agentBusinessList = new List <AgentBusinessModel>();
            AgentBusinessModel        agentBusinessModel;

            try
            {
                _sqlConnService.OpenConnection();
                SqlCommand command = new SqlCommand("SP_GetAllAgentBusiness", _sqlConnService.CreateConnection());
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@CultureId", model.CurrentCulture);
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    agentBusinessModel                = new AgentBusinessModel();
                    agentBusinessModel.ID             = Guid.Parse(reader["ID"].ToString());
                    agentBusinessModel.Code           = reader["Code"].ToString();
                    agentBusinessModel.Name           = reader["Name"].ToString();
                    agentBusinessModel.IsActive       = Convert.ToBoolean(reader["IsActive"].ToString());
                    agentBusinessModel.CreatedDate    = Convert.ToDateTime(reader["CreatedDate"].ToString());
                    agentBusinessModel.CreatedBy      = Convert.ToInt32(reader["CreatedBy"].ToString());
                    agentBusinessModel.UpdatedDate    = Convert.ToDateTime(reader["UpdatedDate"].ToString());
                    agentBusinessModel.UpdatedBy      = Convert.ToInt32(reader["UpdatedBy"].ToString());
                    agentBusinessModel.CurrentUserID  = model.CurrentUserID;
                    agentBusinessModel.CurrentCulture = model.CurrentCulture;
                    agentBusinessList.Add(agentBusinessModel);
                }
                _sqlConnService.CloseConnection();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "AgentBusiness", message);
                throw new Exception(ex.Message);
            }
            return(agentBusinessList);
        }
예제 #6
0
        public dynamic Get_StaffDetails(HomeSearchModel model)
        {
            SqlCommand    cmd;
            SqlDataReader DataReader;
            List <object> lstObjRet = new List <object>();

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

                cmd.Parameters.AddWithValue("@Culture", model.CurrentCulture);
                cmd.Parameters.AddWithValue("@SearchType", model.Search.Type);
                cmd.Parameters.AddWithValue("@Value", model.Search.Value);

                DataReader = cmd.ExecuteReader();
                while (DataReader.Read() == true)
                {
                    object row = new
                    {
                        Id = DataReader["Id"].ToString()
                    };
                    lstObjRet.Add(row);
                }
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(lstObjRet);
        }
        /*******************************************************************************************************************************
        * *****************************************************************************************************************************
        * *****************************************************************************************************************************
        * *****************************************************************************************************************************/


        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));
        }
예제 #8
0
        public EstimationModel GetEstimationByEstimationNo(BaseViewModel model, string EstimationID)
        {
            EstimationModel estimationModel = new EstimationModel();
            Estimation      estimation;

            try
            {
                Guid Id = new Guid(EstimationID);
                estimation      = _orderDetailsRepository.GetEstimationByEstimationID(Id);
                estimationModel = Mapper.Map <Estimation, EstimationModel>(estimation);
                estimationModel.CurrentUserID     = model.CurrentUserID;
                estimationModel.CurrentCulture    = model.CurrentCulture;
                estimationModel.EstimateRouteName = Utility.GetPropertyValue(estimation.Master_EstimationRoutes, "Name", model.CurrentCulture) == null ? string.Empty :
                                                    Utility.GetPropertyValue(estimation.Master_EstimationRoutes, "Name", model.CurrentCulture).ToString();
                estimationModel.ClientName = Utility.GetPropertyValue(estimation.Company, "Name", model.CurrentCulture) == null ? string.Empty :
                                             Utility.GetPropertyValue(estimation.Company, "Name", model.CurrentCulture).ToString();
                estimationModel.OutwardSalesName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                   Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.CoordinatorName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                  Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.SalesPersonName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                  Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.LargeSalesName = Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture) == null ? string.Empty :
                                                 Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
                estimationModel.TotalWithTax = estimation.TotalWithTax;
                //estimationModel.BusinessCategoryName = Utility.GetPropertyValue(estimation.master, "Name", model.CurrentCulture) == null ? string.Empty :
                //                               Utility.GetPropertyValue(estimation.Employee, "Name", model.CurrentCulture).ToString();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "OrderDetails", message);
                throw new Exception(message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }
            return(estimationModel);
        }
예제 #9
0
        public List <JobCategoryModel> GetAllJobCategoryList(JobCategoryModel model)
        {
            List <JobCategoryModel> jobCategories = new List <JobCategoryModel>();
            JobCategoryModel        JobCategoryModel;

            try
            {
                _sqlConnService.OpenConnection();
                SqlCommand command = new SqlCommand("SP_GetAllStaffJobCategory", _sqlConnService.CreateConnection());
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@CultureId", model.CurrentCulture);
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    JobCategoryModel             = new JobCategoryModel();
                    JobCategoryModel.ID          = Guid.Parse(reader["ID"].ToString());
                    JobCategoryModel.Name        = reader["Name"].ToString();
                    JobCategoryModel.SortBy      = Convert.ToInt32(reader["SortBy"].ToString());
                    JobCategoryModel.IsActive    = Convert.ToBoolean(reader["IsActive"].ToString());
                    JobCategoryModel.CreatedDate = Convert.ToDateTime(reader["CreatedDate"].ToString());
                    JobCategoryModel.CreatedBy   = Convert.ToInt32(reader["CreatedBy"].ToString());
                    JobCategoryModel.UpdatedDate = Convert.ToDateTime(reader["UpdatedDate"].ToString());
                    JobCategoryModel.UpdatedBy   = Convert.ToInt32(reader["UpdatedBy"].ToString());
                    jobCategories.Add(JobCategoryModel);
                }
                _sqlConnService.CloseConnection();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(model.CurrentUserID, "JobCategory", message);
                throw new Exception(ex.Message);
            }
            return(jobCategories);
        }
예제 #10
0
        public StaffViewModel GetTranslatorProfile(TranslatorFilterModel model)
        {
            StaffViewModel stfModel = null;
            SqlCommand     cmd, cmd1, cmd2, cmd3;
            SqlDataReader  dataReader, dataReader1, dataReader2, dr3;

            try
            {
                _sqlConnService.OpenConnection();
                cmd             = new SqlCommand("SP_GetTranslatorDetailsByID", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@CultureId", model.CultureCode);
                cmd.Parameters.AddWithValue("@ID", model.ID);
                cmd.Parameters.AddWithValue("@RegistrationID", model.TranslatorNo);

                cmd.CommandType = CommandType.StoredProcedure;
                dataReader      = cmd.ExecuteReader();
                while (dataReader.Read())
                {
                    stfModel                      = new StaffViewModel();
                    stfModel.ID                   = Guid.Parse(dataReader["ID"].ToString());
                    stfModel.TranslatorNo         = Convert.ToInt64(dataReader["TranslatorNo"].ToString());
                    stfModel.Address              = dataReader["Address"].ToString();
                    stfModel.FirstName            = dataReader["FirstName"].ToString();
                    stfModel.LastName             = dataReader["LastName"].ToString();
                    stfModel.MiddleName           = dataReader["MiddleName"].ToString();
                    stfModel.HomeCountryAddress   = dataReader["HomeCountryAddress"].ToString();
                    stfModel.ApartmentName        = dataReader["ApartmentName"].ToString();
                    stfModel.SelfPR               = dataReader["SelfPR"].ToString();
                    stfModel.MainCareer           = dataReader["MainCareer"].ToString();
                    stfModel.Street               = dataReader["Street"].ToString();
                    stfModel.TownName             = dataReader["TownName"].ToString();
                    stfModel.NativeLanguageID     = string.IsNullOrEmpty(dataReader["NativeLanguageID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["NativeLanguageID"].ToString());
                    stfModel.NativeLanguageName   = dataReader["NativeLanguageName"].ToString();
                    stfModel.NationalityID        = dataReader["NationalityID"] == DBNull.Value ? (long?)null : Convert.ToInt64(dataReader["NationalityID"].ToString());
                    stfModel.NationalityName      = dataReader["NationalityName"].ToString();
                    stfModel.ForiegnLanguage1ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage1ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage1ID"].ToString());
                    stfModel.ForiegnLanguage2ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage2ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage2ID"].ToString());
                    stfModel.ForiegnLanguage3ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage3ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage3ID"].ToString());
                    stfModel.ForiegnLanguage4ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage4ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage4ID"].ToString());
                    stfModel.ForeignLanguage1Name = dataReader["ForeignLanguage1Name"].ToString();
                    stfModel.ForeignLanguage2Name = dataReader["ForeignLanguage2Name"].ToString();
                    stfModel.ForeignLanguage3Name = dataReader["ForeignLanguage3Name"].ToString();
                    stfModel.ForeignLanguage4Name = dataReader["ForeignLanguage4Name"].ToString();
                    stfModel.EducationDegree1Name = dataReader["EducationDegree1Name"].ToString();
                    stfModel.EducationDegree2Name = dataReader["EducationDegree2Name"].ToString();
                    stfModel.EducationDegree3Name = dataReader["EducationDegree3Name"].ToString();
                    stfModel.Image                = dataReader["Image"].ToString();
                    stfModel.VisaTypeID           = string.IsNullOrEmpty(dataReader["VisaTypeID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["VisaTypeID"].ToString());
                    stfModel.VisaDeadLine         = dataReader["VisaDeadLine"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(dataReader["VisaDeadLine"]);
                    stfModel.PostalCode           = dataReader["PostalCode"].ToString();

                    stfModel.ProfessionSpecialities = new List <ProfessionalSpecialityViewModel>();
                    cmd1             = new SqlCommand("SP_GetProfessionalSpeciality", _sqlConnService.CreateConnection());
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.AddWithValue("@CultureId", model.CultureCode);
                    cmd1.Parameters.AddWithValue("@StaffID", stfModel.ID);

                    cmd1.CommandType = CommandType.StoredProcedure;
                    dataReader1      = cmd1.ExecuteReader();
                    while (dataReader1.Read())
                    {
                        ProfessionalSpecialityViewModel spc = new ProfessionalSpecialityViewModel();
                        spc.ID   = Convert.ToInt64(dataReader1["ID"].ToString());
                        spc.Name = dataReader1["Name"].ToString();
                        stfModel.ProfessionSpecialities.Add(spc);
                    }

                    dataReader1.Close();
                    stfModel.SoftwareUses = new List <SoftwareUseViewModel>();
                    cmd2             = new SqlCommand("SP_GetSoftwareSkills", _sqlConnService.CreateConnection());
                    cmd2.CommandType = CommandType.StoredProcedure;
                    cmd2.Parameters.AddWithValue("@CultureId", model.CultureCode);
                    cmd2.Parameters.AddWithValue("@StaffID", stfModel.ID);

                    cmd2.CommandType = CommandType.StoredProcedure;
                    dataReader2      = cmd2.ExecuteReader();
                    while (dataReader2.Read())
                    {
                        SoftwareUseViewModel spc = new SoftwareUseViewModel();
                        spc.ID   = Guid.Parse(dataReader2["ID"].ToString());
                        spc.Name = dataReader2["Name"].ToString();
                        stfModel.SoftwareUses.Add(spc);
                    }
                    dataReader2.Close();

                    cmd3             = new SqlCommand("SP_AllTranslation_History", _sqlConnService.CreateConnection());
                    cmd3.CommandType = CommandType.StoredProcedure;
                    cmd3.Parameters.AddWithValue("@ID", stfModel.ID);

                    cmd3.CommandType = CommandType.StoredProcedure;
                    dr3 = cmd3.ExecuteReader();
                    while (dr3.Read())
                    {
                        stfModel.OnlineTranslation    = Convert.ToInt64(dr3["OnlineTranslation"].ToString());
                        stfModel.AppointedTranslation = Convert.ToInt64(dr3["AppointedTranslation"].ToString());
                        stfModel.NativeTranslation    = Convert.ToInt64(dr3["NativeTranslation"].ToString());
                        stfModel.AllTranslation       = stfModel.OnlineTranslation + stfModel.AppointedTranslation + stfModel.NativeTranslation;
                    }
                    dr3.Close();
                }
                dataReader.Close();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                //errorLog.SetErrorLog(model.CurrentUserID, "Staff", message);
                throw new Exception(ex.Message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }

            return(stfModel);
        }
예제 #11
0
        public List <EmployeeModel> GetSearchEmployeeList(BaseViewModel model, string con)
        {
            List <EmployeeModel> employeeList = new List <EmployeeModel>();
            EmployeeModel        employeeModel;

            try
            {
                string branch = con.Split(',')[0];
                long   type   = Convert.ToInt32(con.Split(',')[1]);
                string eid    = con.Split(',')[2];
                bool   resign = Convert.ToBoolean(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_GetSearchAllEmployee", _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("@EmployeeTypeID", DBNull.Value);
                command.Parameters.AddWithValue("@DepartmentID", DBNull.Value);
                if (branch == "")
                {
                    command.Parameters.AddWithValue("@branch", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@branch", branch);
                }
                if (type == 0)
                {
                    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 == false)
                {
                    command.Parameters.AddWithValue("@resign", 1);
                }
                else
                {
                    command.Parameters.AddWithValue("@resign", 0);
                }
                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())
                {
                    employeeModel                  = new EmployeeModel();
                    employeeModel.ID               = Guid.Parse(reader["ID"].ToString());
                    employeeModel.Name             = reader["Name"].ToString();
                    employeeModel.RegistrationID   = Convert.ToInt64(reader["RegistrationID"].ToString());
                    employeeModel.EmployeeID       = reader["EmployeeID"].ToString();
                    employeeModel.CountryName      = reader["CountryName"].ToString();
                    employeeModel.CountryID        = Convert.ToInt64(reader["CountryID"].ToString());
                    employeeModel.DepartmentName   = reader["DepartmentName"].ToString();
                    employeeModel.DepartmentID     = Guid.Parse(reader["DepartmentID"].ToString());
                    employeeModel.BranchName       = reader["BranchName"].ToString();
                    employeeModel.BranchOfficeID   = reader["BranchOfficeID"] == DBNull.Value ? Guid.Empty : Guid.Parse(reader["BranchOfficeID"].ToString());
                    employeeModel.EmployeeTypeName = reader["EmployeeTypeName"].ToString();
                    if (reader["EmployeeTypeID"] != DBNull.Value)
                    {
                        employeeModel.EmployeeTypeID = Convert.ToInt64(reader["EmployeeTypeID"].ToString().Trim());
                    }
                    employeeModel.Password            = reader["Password"].ToString();
                    employeeModel.BirthDate           = Convert.ToDateTime(reader["BirthDate"].ToString());
                    employeeModel.JoiningDate         = Convert.ToDateTime(reader["JoiningDate"].ToString());
                    employeeModel.RegistrationDate    = Convert.ToDateTime(reader["RegistrationDate"].ToString());
                    employeeModel.LeavingDate         = reader["LeavingDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader["LeavingDate"].ToString());
                    employeeModel.AttendanceDay       = Convert.ToInt32(reader["AttendanceDay"].ToString());
                    employeeModel.ClockInTime         = reader["ClockInTime"].ToString();
                    employeeModel.ClockOutTime        = reader["ClockOutTime"].ToString();
                    employeeModel.SkypeID             = reader["SkypeID"].ToString();
                    employeeModel.SkypePassword       = reader["SkypePassword"].ToString();
                    employeeModel.Email               = reader["Email"].ToString();
                    employeeModel.IsResponsiblePerson = Convert.ToBoolean(reader["IsResponsiblePerson"].ToString());
                    employeeModel.HomeAddress         = reader["HomeAddress"].ToString();
                    employeeModel.HomePhone           = reader["HomePhone"].ToString();
                    employeeModel.MobilePhone         = reader["MobilePhone"].ToString();
                    employeeModel.PCEmail             = reader["PCEmail"].ToString();
                    employeeModel.MobileEmail         = reader["MobileEmail"].ToString();
                    employeeModel.Sns_one             = reader["Sns_One"].ToString();
                    employeeModel.Sns_two             = reader["Sns_two"].ToString();
                    employeeModel.BankName            = reader["BankName"].ToString();
                    employeeModel.BankID              = Guid.Parse(reader["BankID"].ToString());
                    employeeModel.BankBranchName      = reader["BankBranchName"].ToString();
                    employeeModel.BankBranchID        = Guid.Parse(reader["BankBranchID"].ToString());
                    employeeModel.BankAccountTypeName = reader["BankBranchName"].ToString();
                    employeeModel.BankAccountTypeID   = Convert.ToInt64(reader["BankAccountTypeID"].ToString());
                    employeeModel.BankAccountNumber   = reader["BankAccountNumber"].ToString();
                    employeeModel.BankAccountName     = reader["BankAccountName"].ToString();
                    employeeModel.Photo               = reader["Photo"].ToString();
                    employeeModel.Signature           = reader["Signature"].ToString();
                    employeeModel.Language_one        = Guid.Parse(reader["Language_one"].ToString());
                    employeeModel.LanguageName1       = reader["LanguageName1"].ToString();
                    employeeModel.Language_two        = Guid.Parse(reader["Language_two"].ToString());
                    employeeModel.LanguageName1       = reader["LanguageName2"].ToString();
                    employeeModel.Language_three      = Guid.Parse(reader["Language_three"].ToString());
                    employeeModel.LanguageName1       = reader["LanguageName3"].ToString();
                    employeeModel.IsActive            = Convert.ToBoolean(reader["Active"].ToString());
                    employeeModel.CreatedDate         = Convert.ToDateTime(reader["CreatedDate"].ToString());
                    employeeModel.CreatedBy           = Convert.ToInt32(reader["CreatedBy"].ToString());
                    employeeModel.UpdatedDate         = Convert.ToDateTime(reader["UpdatedDate"].ToString());
                    employeeModel.UpdatedBy           = Convert.ToInt32(reader["UpdatedBy"].ToString());
                    employeeList.Add(employeeModel);
                }
                _sqlConnService.CloseConnection();
            }
            catch (Exception ex)
            {
                string message = LogException(ex, model.CurrentUserID);
                throw new Exception(message);
            }
            return(employeeList);
        }
예제 #12
0
        public List <StaffViewModel> GetStaffSearchList(BaseViewModel model, Guid?srcLanguageID, Guid?targetLanguageID, Guid?specialFieldID)
        {
            List <StaffViewModel> _list = new List <StaffViewModel>();
            SqlCommand            cmd;
            SqlDataReader         dataReader;

            try
            {
                _sqlConnService.OpenConnection();
                cmd             = new SqlCommand("SP_GetAllTranslators_By_Search", _sqlConnService.CreateConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@CultureId", model.CurrentCulture == null ? null : model.CurrentCulture);
                cmd.Parameters.AddWithValue("@SourceLangID", srcLanguageID == null ? null : srcLanguageID);
                cmd.Parameters.AddWithValue("@TargetLangID", targetLanguageID == null ? null : targetLanguageID);
                cmd.Parameters.AddWithValue("@SpecialFieldID", specialFieldID == null ? null : specialFieldID);
                cmd.CommandType = CommandType.StoredProcedure;
                dataReader      = cmd.ExecuteReader();
                while (dataReader.Read())
                {
                    StaffViewModel stfModel = new StaffViewModel();
                    stfModel.ID                   = Guid.Parse(dataReader["ID"].ToString());
                    stfModel.TranslatorNo         = Convert.ToInt64(dataReader["TranslatorNo"].ToString());
                    stfModel.Address              = dataReader["Address"].ToString();
                    stfModel.FirstName            = dataReader["FirstName"].ToString();
                    stfModel.LastName             = dataReader["LastName"].ToString();
                    stfModel.MiddleName           = dataReader["MiddleName"].ToString();
                    stfModel.HomeCountryAddress   = dataReader["HomeCountryAddress"].ToString();
                    stfModel.ApartmentName        = dataReader["ApartmentName"].ToString();
                    stfModel.SelfPR               = dataReader["SelfPR"].ToString();
                    stfModel.MainCareer           = dataReader["MainCareer"].ToString();
                    stfModel.Street               = dataReader["Street"].ToString();
                    stfModel.TownName             = dataReader["TownName"].ToString();
                    stfModel.NativeLanguageID     = string.IsNullOrEmpty(dataReader["NativeLanguageID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["NativeLanguageID"].ToString());
                    stfModel.NativeLanguageName   = dataReader["NativeLanguageName"].ToString();
                    stfModel.NationalityID        = dataReader["NationalityID"] == DBNull.Value ? (long?)null : Convert.ToInt64(dataReader["NationalityID"].ToString());
                    stfModel.NationalityName      = dataReader["NationalityName"].ToString();
                    stfModel.ForiegnLanguage1ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage1ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage1ID"].ToString());
                    stfModel.ForiegnLanguage2ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage2ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage2ID"].ToString());
                    stfModel.ForiegnLanguage3ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage3ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage3ID"].ToString());
                    stfModel.ForiegnLanguage4ID   = string.IsNullOrEmpty(dataReader["ForiegnLanguage4ID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["ForiegnLanguage4ID"].ToString());
                    stfModel.ForeignLanguage1Name = dataReader["ForeignLanguage1Name"].ToString();
                    stfModel.ForeignLanguage2Name = dataReader["ForeignLanguage2Name"].ToString();
                    stfModel.ForeignLanguage3Name = dataReader["ForeignLanguage3Name"].ToString();
                    stfModel.ForeignLanguage4Name = dataReader["ForeignLanguage4Name"].ToString();
                    stfModel.EducationDegree1Name = dataReader["EducationDegree1Name"].ToString();
                    stfModel.EducationDegree2Name = dataReader["EducationDegree2Name"].ToString();
                    stfModel.EducationDegree3Name = dataReader["EducationDegree3Name"].ToString();
                    stfModel.Image                = dataReader["Image"].ToString();
                    stfModel.VisaTypeID           = string.IsNullOrEmpty(dataReader["VisaTypeID"].ToString()) ? Guid.Empty : Guid.Parse(dataReader["VisaTypeID"].ToString());
                    stfModel.VisaDeadLine         = dataReader["VisaDeadLine"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(dataReader["VisaDeadLine"]);
                    stfModel.PostalCode           = dataReader["PostalCode"].ToString();
                    _list.Add(stfModel);
                }
                dataReader.Close();
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                //errorLog.SetErrorLog(model.CurrentUserID, "Staff", message);
                throw new Exception(ex.Message);
            }
            finally
            {
                _sqlConnService.CloseConnection();
            }


            return(_list);
        }
        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);
        }
예제 #14
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);
        }