Ejemplo n.º 1
0
        public async Task CreateBrokerMaster(BrokersDto input)
        {
            var NewBroker = new BrokerMaster(input.BrokerName, input.Mask, input.LogoPicture, input.Id, input.CountryID);

            int BrokerNewId = await _BrokersRepository.InsertAndGetIdAsync(NewBroker);

            byte[] byteArray = FetchByteArray(input.LogoPicture);

            var NewPicForBroker = new BrokerMasterPics(byteArray, BrokerNewId);

            await _binaryObjectRepository.InsertAsync(NewPicForBroker);
        }
Ejemplo n.º 2
0
        public void VerifyDefaultData(string countrycode)
        {
            int CountryID = _countries.FirstOrDefault(x => x.Code == countrycode).Id;

            string[] defaults    = new string[] { "OTHER", "NONE" };
            string   defaultlogo = "default-profile-picture.png";

            // Verify Bank
            foreach (var data in defaults)
            {
                var bank = _Banks.FirstOrDefault(c => c.BankName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  banknames "OTHER" and "NONE" to tblbanks with countryid and enable
                if (bank == null)
                {
                    var client = new Banks()
                    {
                        BankName  = data,
                        CountryID = CountryID,
                        isActive  = true
                    };
                    _Banks.Insert(client);
                }
                else // Enable Bank if not
                {
                    bank.isActive = true;
                    _Banks.Update(bank);
                }

                // Verify Insurer

                var insurer = _insurer.FirstOrDefault(c => c.InsurerName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  InsurerName "OTHER" and "NONE" to tblinsurerMaster with countryid and enable
                if (insurer == null)
                {
                    var client = new InsurerMaster()
                    {
                        InsurerName = data,
                        CountryID   = CountryID,
                        LogoPicture = defaultlogo,
                        Mask        = data,
                        IsActive    = true
                    };
                    int Id = _insurer.InsertAndGetId(client);

                    var logo = new InsurerPics()
                    {
                        Bytes     = GetBytes(defaultlogo),
                        InsurerID = Id,
                    };
                    _insurerpic.Insert(logo);
                }
                else // Enable Bank if not
                {
                    insurer.IsActive = true;
                    _insurer.Update(insurer);
                }

                // Verify Broker

                var broker = _broker.FirstOrDefault(c => c.BrokerName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  brokerName "OTHER" and "NONE" to tblBrokerMaster with countryid and enable
                if (broker == null)
                {
                    var client = new BrokerMaster()
                    {
                        BrokerName  = data,
                        CountryID   = CountryID,
                        LogoPicture = defaultlogo,
                        Mask        = data,
                        IsActive    = true
                    };
                    int id = _broker.InsertAndGetId(client);


                    var logobroker = new BrokerMasterPics()
                    {
                        Bytes    = GetBytes(defaultlogo),
                        BrokerID = id
                    };
                    _brokerpic.Insert(logobroker);
                }
                else // Enable Bank if not
                {
                    broker.IsActive = true;
                    _broker.Update(broker);
                }
                //Default Vendors
                var vendor = _vendors.FirstOrDefault(c => c.SupplierName == data && c.CountryID == CountryID);
                // If not exist for current country, then add  SupplierName "OTHER" and "NONE" to tblVendorMain with countryid and enable
                if (vendor == null)
                {
                    var client = new VendorMain()
                    {
                        SupplierCode = Guid.NewGuid(),
                        SupplierName = data,
                        CountryID    = CountryID
                    };
                    _vendors.Insert(client);
                }

                //Default Towoperator
                var tow = _tow.FirstOrDefault(c => c.Description == data && c.CountryID == CountryID);
                // If not exist for current country, then add  Description "OTHER" and "NONE" to tblTowOperator with countryid and enable
                if (tow == null)
                {
                    var client = new TowOperator()
                    {
                        Description = data,
                        CountryID   = CountryID,
                        isActive    = true
                    };
                    _tow.Insert(client);
                }
            }
        }
Ejemplo n.º 3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string       brkrt  = TxtBrkRate.Text;
        BrokerMaster objBrk = new BrokerMaster();

        objBrk.BrokerID   = Convert.ToInt32(LblBrokerID.Text);
        objBrk.BrokerCode = TxtBrokerCode.Text.Trim();
        objBrk.FirstName  = TxtFname.Text.Trim();
        objBrk.MiddleName = TxtMname.Text.Trim();
        objBrk.LastName   = TxtLname.Text.Trim();
        objBrk.Address    = TxtAddress.Text.Trim();
        objBrk.Zip        = TxtZip.Text.Trim();
        objBrk.CityID     = Convert.ToInt32(DDLCity.SelectedValue.ToString());
        objBrk.Phone1     = TxtPhone1.Text.Trim();
        objBrk.Phone2     = TxtPhone2.Text.Trim();
        objBrk.Gender     = Rdgender.Text;
        objBrk.DOB        = TxtDob.Text;
        objBrk.EmailID    = TxtEmailID.Text.Trim();
        objBrk.IsActive   = ChekActive.Checked;

        if (TxtBrkRate.Text == "")
        {
            objBrk.BrokerageRate = 0;
        }
        else
        {
            objBrk.BrokerageRate = Convert.ToInt32(brkrt);
        }
        if (LblBrokerID.Text == "0")
        {
            objBrk.Save();
            MessageBox("Record saved successfully");
            BindGvBroker();
            PnlAddBroker.Visible     = true;
            PnlBrokerDetails.Visible = false;
        }
        else
        if (LblBrokerID.Text != "0" || LblBrokerID.Text != "")
        {
            objBrk.Save();
            MessageBox("Record updated successfully");
            BindGvBroker();
            PnlAddBroker.Visible     = false;
            PnlBrokerDetails.Visible = true;
            filter.Visible           = false;
        }
        try
        {
            TxtBrokerCode.Text     = "";
            TxtFname.Text          = "";
            TxtMname.Text          = "";
            TxtLname.Text          = "";
            TxtAddress.Text        = "";
            TxtZip.Text            = "";
            DDLState.SelectedValue = null;
            DDLCity.SelectedValue  = null;
            DDLCity.Enabled        = false;
            TxtPhone1.Text         = "";
            TxtPhone2.Text         = "";
            Rdgender.Text          = "";
            TxtDob.Text            = "";
            TxtEmailID.Text        = "";
            TxtBrkRate.Text        = "";
            ChekActive.Checked     = false;
        }
        catch
        {
        }
    }
Ejemplo n.º 4
0
 public void BindGvBroker()
 {
     GrdBroker.DataSource = BrokerMaster.GetBrokerMaster();
     GrdBroker.DataBind();
 }