示例#1
0
        public CCBContractor DeleteAliasName(CCBContractor model)
        {
            CCBContractor result = model;

            contractorLogic.DeleteAliasName(model);
            return(result);
        }
 void SendContractor(CCBContractor contractor)
 {
     if (contractor != null)
     {
         Messenger.Default.Send <MessageCommunicator>(new MessageCommunicator()
         {
             ContractorInfo = contractor
         });
     }
 }
        //public RelayCommand SelectCountriesCommand
        //{
        //    get { return _selectCountriesCommand; }
        //}

        //public RelayCommand DeSelectCountriesCommand
        //{
        //    get { return _deSelectCountriesCommand; }
        //}

        public ContractorPermitProcessViewModel(IDataService dataService, PermitModel permit, MdiContainer container)
        {
            _container     = container;
            _dataService   = dataService;
            AffidavitInfo  = new sw_posting();
            ContractorInfo = new CCBContractor();
            GetAffidavitByNumber(permit.Permit.AffidavitID.ToString());
            GetContractorByCCB(permit.Permit.BuilderBoardNo);
            ApplicantInfo     = permit.Applicant;
            PermitHistoryInfo = new ApplicantPermitHistory();
            GetPermitHistory(ApplicantInfo.Name);
            TotalFee          = "0.00";
            Permits           = new ObservableCollection <ContractorPermit>();
            PermitPaymentInfo = new PermitPayment();
            NewExpireDate     = DateTime.Now;
            //GetPermitByContractor(permit.Permit.ContractorID);
            GetPermitByContractor(permit.Permit.PermitApplicant.Name);
            PermitInfo = permit;
            //PermitNumber = permit.Permit.PermitNo.ToString();
            if (permit.Applicant.ApplicantType == "Contractor")
            {
                ContractorRadio = true;
            }
            if (permit.Applicant.ApplicantType == "Owner")
            {
                OwnerRadio = true;
            }
            if (permit.Applicant.ApplicantType == "Other")
            {
                OtherRadio = true;
            }
            //GetAffidavitCostsDetails();
            AcceptButtonModel           = true;
            PermitPaymentInfo.IssueDate = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            PermitPaymentInfo.IssuedBy  = new string(Environment.UserName.ToUpper().Take(3).ToArray());
            this.CalculateAmountCommand = new RelayCommand(AcceptPermit);
            AcceptPermitFeeCommand      = new RelayCommand(AcceptPermitFee);
            RejectAllPermitsCommand     = new RelayCommand(RejectAllPermits);
            HoldPermitCommand           = new RelayCommand(HoldPermit);
            string env = ConfigurationManager.AppSettings["AppEnvironment"];

            PermitReportFactory.AppEnvironment = env;
            showPermitDetailsCommand           = new RelayCommand <long>((s) => ShowPermitDetails(s));
            //Full Set=2 Copies +Instructions, CustomerSet = 1 Copy +Instructions, FileCopy = Our Copy, Instructions =Instructions only, Permit = 1 Copy, None = No print
            PrintOptionData.Add("None");
            //PrintOptionData.Add("Permit");
            //PrintOptionData.Add("Instructions");
            PrintOptionData.Add("File Copy");
            PrintOptionData.Add("Customer Copy");
            PrintOptionData.Add("Customer and File Copy");
            SelectedPrintOption = "Customer and File Copy";
        }
示例#4
0
        public CCBContractor SearchContractor(string ccbNumber)
        {
            CCBContractor result = new CCBContractor();

            try
            {
                if (!string.IsNullOrEmpty(ccbNumber))
                {
                    result = contractorLogic.SearchContractor(ccbNumber);
                }
            }
            catch (Exception)
            {
                result = null;
            }
            return(result);
        }
示例#5
0
        public CCBContractor UpdateAliasName(CCBContractor model)
        {
            try
            {
                long licenseNumber = long.Parse(model.license_number);
                var  alias         = context.Contractor_Alias.Where(x => x.CCB_No.Equals(licenseNumber)).FirstOrDefault();
                var  ccb           = context.CCB_DAILY_LICENSES.Where(x => x.license_number.Equals(licenseNumber)).FirstOrDefault();

                if (alias != null && !string.IsNullOrEmpty(alias.Alias))
                {
                    //alias.Alias = model.alias_name;
                    alias.Alias = model.alias_name.Replace("&", "AND");

                    //ccb.alias_name = model.alias_name;
                    ccb.alias_name = model.alias_name.Replace("&", "AND");

                    context.SaveChanges();
                }
                else
                {
                    Contractor_Alias newAlias = new Contractor_Alias();

                    //newAlias.Alias = model.alias_name;
                    newAlias.Alias = model.alias_name.Replace("&", "AND");

                    newAlias.Business_Name       = model.business_name;
                    newAlias.CCB_No              = long.Parse(model.license_number);
                    newAlias.Contractor_Alias_Id = Guid.NewGuid();
                    newAlias.Created_Date        = DateTime.Now;
                    context.Contractor_Alias.Add(newAlias);

                    //ccb.alias_name = model.alias_name;
                    ccb.alias_name = model.alias_name.Replace("&", "AND");

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                model = null;
            }
            return(model);
        }
示例#6
0
        public StaffPermitProcessViewModel(IDataService dataService, PermitModel permit, MdiContainer container)
        {
            _container     = container;
            _dataService   = dataService;
            AffidavitInfo  = new sw_posting();
            ContractorInfo = new CCBContractor();
            GetAffidavitByNumber(permit.Permit.AffidavitID.ToString());
            GetContractorByCCB(permit.Permit.BuilderBoardNo);
            ApplicantInfo     = permit.Applicant;
            PermitPaymentInfo = new PermitPayment();
            PermitInfo        = permit;
            AcceptButtonModel = true;
            //PermitNumber = permit.Permit.PermitNo.ToString();
            if (permit.Applicant.ApplicantType == "Contractor")
            {
                ContractorRadio = true;
            }
            if (permit.Applicant.ApplicantType == "Owner")
            {
                OwnerRadio = true;
            }
            if (permit.Applicant.ApplicantType == "Other")
            {
                OtherRadio = true;
            }
            AffidavitCostsDetails = new ObservableCollection <sw_action_detail>();
            GetAffidavitCostsDetails(permit.Permit.AffidavitID.ToString());

            PermitPaymentInfo.IssueDate = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            PermitPaymentInfo.IssuedBy  = new string(Environment.UserName.ToUpper().Take(3).ToArray());

            AcceptPermitCommand = new RelayCommand(AcceptPermit);
            RejectPermitCommand = new RelayCommand(RejectPermit);
            HoldPermitCommand   = new RelayCommand(HoldPermit);
            //Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
            string env = ConfigurationManager.AppSettings["AppEnvironment"];

            PermitReportFactory.AppEnvironment = env;
        }
示例#7
0
        public bool DeleteAliasName(CCBContractor model)
        {
            bool result = false;

            try
            {
                long licenseNumber = long.Parse(model.license_number);
                var  alias         = context.Contractor_Alias.Where(x => x.CCB_No.Equals(licenseNumber)).FirstOrDefault();
                var  ccb           = context.CCB_DAILY_LICENSES.Where(x => x.license_number.Equals(licenseNumber)).FirstOrDefault();
                if (alias != null && !string.IsNullOrEmpty(alias.Alias))
                {
                    context.Contractor_Alias.Remove(alias);
                    ccb.alias_name = null;
                    context.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                result = false;
            }
            return(result);
        }
示例#8
0
 public CCBContractor UpdateAliasName(CCBContractor model)
 {
     contractorLogic.UpdateAliasName(model);
     return(model);
 }
        public ReviewModifyTransferPermitViewModel(IDataService dataService, PermitModel permit, MdiContainer container)
        {
            _container   = container;
            _dataService = dataService;
            //AffidavitInfo = new sw_posting();
            ContractorInfo = new CCBContractor();
            GetAffidavitByNumber(permit.Permit.AffidavitID.ToString());
            GetContractorByCCB(permit.Permit.BuilderBoardNo);
            IsDatePickerEnabled = true;
            ApplicantInfo       = permit.Applicant;
            PreviousApplicantID = permit.Applicant.ApplicantID;
            CCBNumber           = permit.Permit.BuilderBoardNo;
            CCBNumberOld        = permit.Permit.BuilderBoardNo;
            PermitInfo          = permit.Permit;

            ApplicantName = permit.Applicant.Name;
            Contact       = permit.Applicant.Contact;
            Address       = permit.Applicant.Address;
            City          = permit.Applicant.City;
            ST            = permit.Applicant.State;
            Zip           = permit.Applicant.Zip;
            PhoneNumber   = permit.Applicant.PhoneNumber;

            GetPermitPayment(permit.Permit.PermitID);
            ContractorList = new ObservableCollection <string>();
            PermitNumber   = permit.Permit.PermitID.ToString();
            if (permit.Applicant.ApplicantType == "Contractor")
            {
                ContractorRadio = true;
            }
            if (permit.Applicant.ApplicantType == "Owner")
            {
                OwnerRadio = true;
            }
            if (permit.Applicant.ApplicantType == "Other")
            {
                OtherRadio = true;
            }
            AffidavitCostsDetails = new ObservableCollection <sw_action_detail>();
            //GetAffidavitCostsDetails(permit.Permit.AffidavitID.ToString());
            PermitCostsDetails = new ObservableCollection <PermitCostsDetail>();
            GetPermitCostsDetails(permit.Permit.AffidavitID.ToString());

            IssuedBy                 = "NA";
            IssuedDate               = DateTime.MaxValue;
            IsPermitExtended         = (PermitInfo.PermitExtended.Equals("Yes")) ? true : false;
            UpdateCommand            = new RelayCommand(UpdatePermit);
            ContractorChecked        = new RelayCommand(UpdateContractor);
            CancelCommand            = new RelayCommand(Cancel);
            SearchContractorCommand  = new RelayCommand(ContractorSearch);
            ContractorSelectCommand  = new RelayCommand(ContractorSelect);
            PrintCommand             = new RelayCommand(PrintPermit);
            OwnerChecked             = new RelayCommand(OwnerRadioChanged);
            OtherChecked             = new RelayCommand(OtherRadioChanged);
            ShowPermitHistoryCommand = new RelayCommand(ShowPermitHistory);
            //PermitInfo.DateExpiredNew = PermitInfo.DateExpired;
            PermitReportFactory.AppEnvironment = ConfigurationManager.AppSettings["AppEnvironment"];
            SaveButtonModel = true;
            //Full Set=2 Copies +Instructions, CustomerSet = 1 Copy +Instructions, FileCopy = Our Copy, Instructions =Instructions only, Permit = 1 Copy, None = No print
            PrintOptionData.Add("None");
            //PrintOptionData.Add("Permit");
            //PrintOptionData.Add("Instructions");
            PrintOptionData.Add("File Copy");
            PrintOptionData.Add("Customer Copy");
            PrintOptionData.Add("Customer and File Copy");
            SelectedPrintOption = "None";
        }
示例#10
0
        /// <summary>
        /// This method will search first for contractor licence number, if not found then it will search for contractor name  <add key="UseOracle" value="true" />
        /// </summary>
        /// <param name="ccbNumber"></param>
        /// <returns></returns>
        public CCBContractor SearchContractor(string ccbNumber)
        {
            CCBContractor result = new CCBContractor();

            try
            {
                if (bool.Parse(ConfigurationManager.AppSettings["UseOracle"].ToString()))
                {
                    using (OracleConnection conn = new OracleConnection(oracleConnection))
                    {
                        using (OracleCommand command = conn.CreateCommand())
                        {
                            string sql = "SELECT S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10, S_11, S_12, S_13, S_14," +
                                         "S_15, S_16, S_17, S_18, S_19, S_20, S_21, S_22, S_23, S_24, S_25, S_26, S_27, S_28, S_29" +
                                         " FROM AMANDA.CCB_DAILY_LICENSES where  S_1 like '%" + ccbNumber.ToUpper() + "%' order by S_1";

                            //string sql = "SELECT S_1, S_4, S_5, S_6, S_7, S_8, S_9, S_27, S_28 FROM AMANDA.CCB_DAILY_LICENSES where  S_1 like '%" + ccbNumber.ToUpper() + "%' order by S_1";

                            //string sql = "SELECT S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10, S_11, S_12, S_13, S_14," +
                            //  "S_15, S_16, S_17, S_18, S_19, S_20, S_21, S_22, S_23, S_24, S_25, S_26, S_27, S_28, S_29" +
                            //  " FROM AMANDA.CCB_DAILY_LICENSES where UPPER(S_4) LIKE " + ccbNumber.ToUpper() + "%' or S_1 like '%" + ccbNumber.ToUpper() + "%'";
                            command.CommandText = sql;
                            conn.Open();
                            OracleDataReader dataReader = command.ExecuteReader();
                            while (dataReader.Read())
                            {
                                result.license_number = dataReader["S_1"].ToString();

                                //result.business_name = dataReader["S_4"].ToString();
                                result.business_name = dataReader["S_4"].ToString().Replace("&", "AND");

                                result.address            = dataReader["S_5"].ToString();
                                result.city               = dataReader["S_6"].ToString();
                                result.state              = dataReader["S_7"].ToString();
                                result.zip                = dataReader["S_8"].ToString();
                                result.business_telephone = dataReader["S_9"].ToString();
                                result.rmi_name           = dataReader["S_27"].ToString();
                                //result.lic_exp_date = (DateTime)dataReader["S_28"];
                            }
                        }
                        // Close and Dispose OracleConnection object
                        conn.Close();
                        conn.Dispose();
                    }
                    if (result.license_number == null)
                    {
                        using (OracleConnection conn = new OracleConnection(oracleConnection))
                        {
                            using (OracleCommand command = conn.CreateCommand())
                            {
                                string sql = "SELECT S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10, S_11, S_12, S_13, S_14," +
                                             "S_15, S_16, S_17, S_18, S_19, S_20, S_21, S_22, S_23, S_24, S_25, S_26, S_27, S_28, S_29" +
                                             " FROM AMANDA.CCB_DAILY_LICENSES where  UPPER(S_4) LIKE " + ccbNumber.ToUpper() + "%'";

                                //string sql = "SELECT S_1, S_4, S_5, S_6, S_7, S_8, S_9, S_27, S_28 FROM AMANDA.CCB_DAILY_LICENSES where  UPPER(S_4) LIKE " + ccbNumber.ToUpper() + "%' ";

                                //string sql = "SELECT S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10, S_11, S_12, S_13, S_14," +
                                //  "S_15, S_16, S_17, S_18, S_19, S_20, S_21, S_22, S_23, S_24, S_25, S_26, S_27, S_28, S_29" +
                                //  " FROM AMANDA.CCB_DAILY_LICENSES where UPPER(S_4) LIKE " + ccbNumber.ToUpper() + "%' or S_1 like '%" + ccbNumber.ToUpper() + "%'";
                                command.CommandText = sql;
                                conn.Open();
                                OracleDataReader dataReader = command.ExecuteReader();
                                while (dataReader.Read())
                                {
                                    result.license_number     = dataReader["S_1"].ToString();
                                    result.business_name      = dataReader["S_4"].ToString().Replace("&", "AND").Substring(0, 50);
                                    result.address            = dataReader["S_5"].ToString();
                                    result.city               = dataReader["S_6"].ToString();
                                    result.state              = dataReader["S_7"].ToString();
                                    result.zip                = dataReader["S_8"].ToString();
                                    result.business_telephone = dataReader["S_9"].ToString();
                                    result.rmi_name           = dataReader["S_27"].ToString();
                                    //result.lic_exp_date = (DateTime)dataReader["S_28"];
                                }
                            }
                            // Close and Dispose OracleConnection object
                            conn.Close();
                            conn.Dispose();
                        }
                    }
                }
                else
                {
                    using (SqlConnection con = new SqlConnection(ConnectionHelper.ConnectionString))
                    {
                        using (SqlCommand cmd = new SqlCommand("getContractorDetailsByCCBNumber", con))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@ccbNumber", SqlDbType.NVarChar).Value = ccbNumber;
                            con.Open();
                            SqlDataReader dataReader = cmd.ExecuteReader();
                            if (dataReader.HasRows)
                            {
                                while (dataReader.Read())
                                {
                                    result.license_number = dataReader["license_number"].ToString();

                                    //result.business_name = dataReader["business_name"].ToString();
                                    result.business_name = dataReader["business_name"].ToString().Replace("&", "AND");

                                    result.address            = dataReader["address"].ToString();
                                    result.city               = dataReader["city"].ToString();
                                    result.state              = dataReader["state"].ToString();
                                    result.zip                = dataReader["zip"].ToString();
                                    result.business_telephone = dataReader["business_telephone"].ToString();
                                    result.rmi_name           = dataReader["rmi_name"].ToString();
                                    //result.lic_exp_date = (DateTime)dataReader["lic_exp_date"];
                                }
                            }
                        }
                    }
                    if (result.license_number == null)
                    {
                        using (SqlConnection con = new SqlConnection(ConnectionHelper.ConnectionString))
                        {
                            using (SqlCommand cmd = new SqlCommand("getContractorDetailsByName", con))
                            {
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.Parameters.AddWithValue("@name", SqlDbType.NVarChar).Value = ccbNumber;
                                con.Open();
                                SqlDataReader dataReader = cmd.ExecuteReader();
                                if (dataReader.HasRows)
                                {
                                    while (dataReader.Read())
                                    {
                                        result.license_number = dataReader["license_number"].ToString();

                                        //result.business_name = dataReader["business_name"].ToString();
                                        result.business_name = dataReader["business_name"].ToString().Replace("&", "AND");

                                        result.address            = dataReader["address"].ToString();
                                        result.city               = dataReader["city"].ToString();
                                        result.state              = dataReader["state"].ToString();
                                        result.zip                = dataReader["zip"].ToString();
                                        result.business_telephone = dataReader["business_telephone"].ToString();
                                        result.rmi_name           = dataReader["rmi_name"].ToString();
                                        //result.lic_exp_date = (DateTime)dataReader["lic_exp_date"];
                                    }
                                }
                            }
                        }
                    }
                }
                if (result != null && !string.IsNullOrEmpty(result.license_number))
                {
                    long licenseNumber = long.Parse(result.license_number);
                    result.alias_name = string.Empty;
                    var contractorAlias = context.Contractor_Alias.Where(x => x.CCB_No.Equals(licenseNumber)).FirstOrDefault();
                    if (contractorAlias != null && !string.IsNullOrEmpty(contractorAlias.Alias))
                    {
                        result.alias_name = contractorAlias.Alias;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                result = null;
            }
            return(result);
        }