Example #1
0
        void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                objMaster = new CompanyBO();

                try
                {
                    objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt());
                    objMaster.Delete(objMaster.Current);
                }
                catch (Exception ex)
                {
                    if (objMaster.Errors.Count > 0)
                    {
                        ENUtils.ShowMessage(objMaster.ShowErrors());
                    }
                    else
                    {
                        ENUtils.ShowMessage(ex.Message);
                    }
                    e.Cancel = true;
                }
            }
        }
Example #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            {
                int companyId = int.Parse(hdnSelectedCompanyID.Value.Trim());

                if (companyId > 0)
                {
                    try
                    {
                        using (TransactionScope ts = new TransactionScope())
                        {
                            CompanyBO objCompany = new CompanyBO(this.ObjContext);
                            objCompany.ID = companyId;
                            objCompany.GetObject();

                            objCompany.IsActive = false;
                            objCompany.IsDelete = true;

                            this.ObjContext.SaveChanges();
                            ts.Complete();
                        }

                        this.PopulateDataGrid();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
Example #3
0
        public ActionResult Index()
        {
            LoginViewModel model = new LoginViewModel();

            //var compist = new CompanyBO().GetList();
            //for(var i = 0;i < compist.Count;i++)
            //{
            //    compist[i].CompanyCode = UrlEncryptionHelper.Encrypt(compist[i].CompanyCode);
            //}
            //model.CompaniesList = new SelectList(compist, "CompanyCode", "CompanyName");
            var companyCode = "EZY";
            var branchList  = new BranchBO().GetList().Where(x => x.CompanyCode == companyCode).ToList();

            model.BranchList = new SelectList(branchList, "BranchID", "BranchName").ToList();

            var compist = new CompanyBO().GetList();

            for (var i = 0; i < compist.Count; i++)
            {
                compist[i].CompanyCode = UrlEncryptionHelper.Encrypt(compist[i].CompanyCode);
            }
            model.CompanyCode   = "EZY";
            model.CompaniesList = new SelectList(compist, "CompanyCode", "CompanyName");
            return(View(model));
        }
        /// <summary>
        /// Edit By Rashedul Hasan on july 29 2015
        /// Add IsMargin Column
        /// </summary>
        /// <param name="companyShortCode"></param>
        /// <returns></returns>
        public void Insert(CompanyBO companyBo)
        {
            string companyQueryString = "";

            companyQueryString = @"SBPSaveCompany";
            try
            {
                _dbConnection.ConnectDatabase();
                _dbConnection.ActiveStoredProcedure();
                _dbConnection.AddParameter("@CompanyShortCode", SqlDbType.NVarChar, companyBo.CompanyShortCode);
                _dbConnection.AddParameter("@CompanyName", SqlDbType.NVarChar, companyBo.CompanyName);
                _dbConnection.AddParameter("@CompanyCategoryID", SqlDbType.Int, companyBo.CompanyCategoryID);
                _dbConnection.AddParameter("@FaceValue", SqlDbType.Float, companyBo.FaceValue);
                _dbConnection.AddParameter("@MarketLot", SqlDbType.Decimal, companyBo.MarketLot);
                _dbConnection.AddParameter("@ShareType", SqlDbType.VarChar, companyBo.ShareType);
                _dbConnection.AddParameter("@IssuerId", SqlDbType.Decimal, companyBo.IssuerId);
                _dbConnection.AddParameter("@ISINNo", SqlDbType.NVarChar, companyBo.ISINNo);
                _dbConnection.AddParameter("@Remarks ", SqlDbType.NVarChar, companyBo.Remarks);
                _dbConnection.AddParameter("@status ", SqlDbType.Int, companyBo.CompanyStatus);
                _dbConnection.AddParameter("@OpeningDate", SqlDbType.DateTime, companyBo.OpeningDate);
                _dbConnection.AddParameter("@entryBy", SqlDbType.VarChar, GlobalVariableBO._userName);
                _dbConnection.AddParameter("@SectorID", SqlDbType.Int, companyBo.CompanySectorID);
                _dbConnection.AddParameter("@CodeNo", SqlDbType.VarChar, companyBo.CompanyShortNumber);
                _dbConnection.AddParameter("@IsMargin", SqlDbType.Bit, companyBo.IsMargin);
                _dbConnection.ExecuteNonQuery(companyQueryString);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                _dbConnection.CloseDatabase();
            }
        }
 public AdministrationController()
 {
     addressBO      = new AddressBO(SESSIONOBJ);
     companyBO      = new CompanyBO(SESSIONOBJ);
     branchBO       = new BranchBO(SESSIONOBJ);
     contributionBO = new ContributionBO(SESSIONOBJ);
 }
Example #6
0
        public static void SendMailNotifications(UserBO objSender, UserBO objReceiver, string title, string emailContent)
        {
            CompanyBO objCompany = new CompanyBO();

            objCompany.ID = objSender.Company;
            objCompany.GetObject();

            string fromName  = objSender.GivenName + " " + objSender.FamilyName;
            string fromEmail = objSender.EmailAddress;
            string toName    = objReceiver.GivenName + " " + objReceiver.FamilyName;
            string hostUrl   = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/";

            string mailBody = EmailTemplate;

            mailBody = mailBody.Replace("<$headerBGColor$>", "#222");
            mailBody = mailBody.Replace("<$accountname$>", objCompany.Name);
            mailBody = mailBody.Replace("<$accountheader$>", objCompany.Name);
            mailBody = mailBody.Replace("<$accountURL$>", "<a href=\"http://" + hostUrl + "\">" + hostUrl + "</a>");
            mailBody = mailBody.Replace("<$title$>", title);
            mailBody = mailBody.Replace("<$imageURL$>", "http://" + hostUrl);
            mailBody = mailBody.Replace("<$firstname$>", objReceiver.GivenName);
            mailBody = mailBody.Replace("<$content$>", emailContent);
            mailBody = mailBody.Replace("<$headerlink$>", "#09F");
            mailBody = mailBody.Replace("<$normallink$>", "#06F");
            mailBody = mailBody.Replace("<$h1link$>", "#03F");

            SendMail(fromName, fromEmail, toName, objReceiver.EmailAddress, "", title, null, "", false, mailBody);
        }
Example #7
0
        public void NotConvertBO_WithNull()
        {
            CompanyBO nullEntity = null;
            var       entity     = _converter.Convert(nullEntity);

            Assert.Null(entity);
        }
        /// <summary>
        /// Populate the controls.
        /// </summary>
        private void PopulateControls()
        {
            // Header Text
            this.litHeaderText.Text = this.ActivePage.Heading;

            // Populate Price Levels
            this.rptPriceLevels.DataSource = (new PriceLevelBO()).GetAllObject().ToList();
            this.rptPriceLevels.DataBind();

            ViewState["IsPageValied"] = true;

            this.PopulateDataGrid();

            // Populate distributors dropdown

            GetNonAssignedPriceMarkupDistributorsViewBO        objgnapmd = new GetNonAssignedPriceMarkupDistributorsViewBO();
            List <GetNonAssignedPriceMarkupDistributorsViewBO> lstgnpmd  = (from o in objgnapmd.SearchObjects() orderby o.Name select o).ToList();

            DistributorPriceMarkupExtentions.BindList(this.ddlDistributors, lstgnpmd, "ID", "Name");
            DistributorPriceMarkupExtentions.BindListClone(this.ddlNewDistributors, lstgnpmd, "ID", "Name");

            this.ddlDistributors.Items.FindByValue(lstgnpmd[1].ID.ToString()).Selected = true;

            this.ddlExistDistributors.Items.Add(new ListItem("Platinum", "0"));
            List <int> lstExistDistributor = (new DistributorPriceMarkupBO()).SearchObjects().Where(o => o.Distributor != null && o.Distributor > 0 && o.objDistributor.IsActive == true && o.objDistributor.IsDelete == false).OrderBy(o => o.objDistributor.Name).Select(o => (int)o.Distributor).Distinct().ToList();

            foreach (int distributor in lstExistDistributor)
            {
                CompanyBO objComPany = new CompanyBO();
                objComPany.ID = distributor;
                objComPany.GetObject();

                this.ddlExistDistributors.Items.Add(new ListItem(objComPany.Name, objComPany.ID.ToString()));
            }
        }
        protected void dataGridCompany_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is CompanyBO)
            {
                CompanyBO objCompany = (CompanyBO)item.DataItem;

                //HyperLink lnkEdit = (HyperLink)item.FindControl("lnkEdit");

                HyperLink lnkDelete = (HyperLink)item.FindControl("lnkDelete");

                Label lblCompanyType = (Label)item.FindControl("lblCompanyType");

                lblCompanyType.Text = objCompany.objType.Name.ToString();

                Label lblCoordinator = (Label)item.FindControl("lblCoordinator");
                if (objCompany.Coordinator != 0)
                {
                    lblCoordinator.Text = objCompany.objCoordinator.GivenName + "" + objCompany.objCoordinator.FamilyName;
                }
                else
                {
                    lblCoordinator.Text = "No Coordinator";
                }
            }
        }
Example #10
0
        public frmCompanyList()
        {
            try
            {
                InitializeComponent();
                this.Load += new EventHandler(frmCompanyList_Load);
                //LoadCompanyList();
                ////skip = 0;
                ////txtSearch.Text = string.Empty;
                //PopulateData();

                grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick);
                grdLister.RowsChanging    += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging);
                objMaster = new CompanyBO();

                this.SetProperties((INavigation)objMaster);
                grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick);

                grdLister.ShowRowHeaderColumn = false;
                //this.Shown += new EventHandler(frmCompanyList_Shown);


                //PopulateData();
                //---- adil
                grdLister.ShowGroupPanel = false;
                pageSize = AppVars.objPolicyConfiguration.ListingPagingSize.ToInt();

                grdLister.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            }
            catch (Exception ex)
            {
                //ex.Message
                ENUtils.ShowMessage(ex.Message);
            }
        }
Example #11
0
 public frmCompanyCharges()
 {
     InitializeComponent();
     objMaster = new CompanyBO();
     this.SetProperties((INavigation)objMaster);
     FormatExtraChargesGrid();
     this.Shown += new EventHandler(frmCompanyCharges_Shown);
 }
Example #12
0
 public CompanyBO Create(CompanyBO bo)
 {
     using (var unitOfWork = _uow)
     {
         var convertedEntity = _converter.Convert(bo);
         var createdEntity   = unitOfWork.CompanyRepository.Create(convertedEntity);
         unitOfWork.Complete();
         return(_converter.Convert(createdEntity));
     }
 }
Example #13
0
        protected void ddlCompany_SelectedIndexChange(object sender, EventArgs e)
        {
            int company = int.Parse(this.ddlCompany.SelectedItem.Value);

            this.ddlRole.Enabled = true;
            if (company > 0)
            {
                CompanyBO objComapny = new CompanyBO();
                objComapny.ID = company;
                objComapny.GetObject();
                //Populate User Role
                this.ddlRole.Items.Clear();
                this.ddlRole.Items.Add(new ListItem("Select Your Role", "0"));
                List <RoleBO> lstRole = new List <RoleBO>();
                switch (objComapny.Type)
                {
                case 1:     //Factory
                {
                    lstRole = (from o in (new RoleBO()).SearchObjects()
                               where o.ID > 1 && o.ID < 5
                               select o).ToList();
                    break;
                }

                case 2:     //Manufacturer
                {
                    lstRole = (from o in (new RoleBO()).SearchObjects()
                               where o.ID > 4 && o.ID < 7         // 4- 7
                               select o).ToList();
                    break;
                }

                case 3:     //Sales
                {
                    lstRole = (from o in (new RoleBO()).SearchObjects()
                               where o.ID > 6 && o.ID < 10
                               select o).ToList();
                    break;
                }

                case 4:     //Distributor
                {
                    lstRole = (from o in (new RoleBO()).SearchObjects()
                               where o.ID > 9 && o.ID < 12
                               select o).ToList();
                    break;
                }
                }
                foreach (RoleBO role in lstRole)
                {
                    this.ddlRole.Items.Add(new ListItem(role.Description, role.ID.ToString()));
                }
            }
        }
        private void PopulateCoordinator(int distributor)
        {
            if (distributor > 0)
            {
                CompanyBO objCompany = new CompanyBO();
                objCompany.ID = distributor;
                objCompany.GetObject();

                this.txtCoordinator.Text  = objCompany.objCoordinator.GivenName + " " + objCompany.objCoordinator.FamilyName;
                this.hdnCoordinator.Value = objCompany.Coordinator.ToString();
            }
        }
Example #15
0
 public IActionResult Post([FromBody] CompanyBO value)
 {
     if (value == null)
     {
         return(new BadRequestObjectResult(ErrorMessages.InvalidEntityString));
     }
     if (!ModelState.IsValid)
     {
         return(new BadRequestObjectResult(ModelState));
     }
     return(new OkObjectResult(_service.Create(value)));
 }
Example #16
0
        /// <summary>
        /// Populate the controls.
        /// </summary>
        private void PopulateControls()
        {
            // Header Text
            this.litHeaderText.Text = this.ActivePage.Heading;

            CompanyBO objCompany = new CompanyBO();

            objCompany.ID = this.LoggedUser.Company;
            objCompany.GetObject();

            //populate cordinators
            List <UserBO> lstUsers = objCompany.UsersWhereThisIsCompany;

            this.ddlCoordinator.Items.Add(new ListItem("Select coordinator", "0"));
            foreach (UserBO user in lstUsers)
            {
                this.ddlCoordinator.Items.Add(new ListItem(user.GivenName, user.ID.ToString()));
            }

            //Populate Countries
            List <CountryBO> lstCountries = (new CountryBO()).GetAllObject();

            foreach (CountryBO country in lstCountries)
            {
                this.ddlCountry.Items.Add(new ListItem(country.Name, country.ID.ToString()));
            }
            //UserBO objUser = new UserBO(this.ObjContext);
            //objUser.ID =
            //objUser.GetObject();


            this.txtName.Text                 = objCompany.Name;
            this.txtNickName.Text             = objCompany.NickName;
            this.ddlCoordinator.SelectedValue = objCompany.Coordinator.ToString();
            this.ddlCoordinator.Enabled       = false;
            this.txtFirstName.Text            = LoggedCompany.objCoordinator.GivenName;
            this.txtLastName.Text             = LoggedCompany.objCoordinator.FamilyName;


            this.txtAddress1.Text         = objCompany.Address1;
            this.txtAddress2.Text         = objCompany.Address2;
            this.txtCity.Text             = objCompany.City;
            this.txtState.Text            = objCompany.State;
            this.txtPostcode.Text         = objCompany.Postcode;
            this.ddlCountry.SelectedValue = objCompany.Country.ToString();
            this.txtPhone1.Text           = objCompany.Phone1;
            this.txtPhone2.Text           = objCompany.Phone2;
            this.txtMobile.Text           = LoggedCompany.objCoordinator.MobileTelephoneNumber;
            this.txtEmailAddress.Text     = objCompany.objCoordinator.EmailAddress;
            this.txtFaxNo.Text            = objCompany.Fax;
            rfvGender.Enabled             = false;
            rfvCoordinator.Enabled        = false;
        }
        private void PopulateDataGrid()
        {
            // Hide Controls
            this.dvEmptyContent.Visible   = false;
            this.dvDataContent.Visible    = false;
            this.dvNoSearchResult.Visible = false;

            // Search text
            string searchText = this.txtSearch.Text.ToLower().Trim();

            // Populate Company
            CompanyBO objCompany = new CompanyBO();


            List <CompanyBO> lstCompany = new List <CompanyBO>();

            if ((searchText != string.Empty) && (searchText != "search"))
            {
                lstCompany = (from o in objCompany.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList()
                              where o.Name.ToLower().Contains(searchText)
                              select o).ToList();
            }
            else
            {
                lstCompany = objCompany.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList();
            }

            if (lstCompany.Count > 0)
            {
                this.dataGridCompany.AllowPaging = (lstCompany.Count > this.dataGridCompany.PageSize);
                this.dataGridCompany.DataSource  = lstCompany;
                this.dataGridCompany.DataBind();

                this.dvDataContent.Visible = true;
            }
            else if ((searchText != string.Empty && searchText != "search"))
            {
                this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " - " : string.Empty);

                this.dvDataContent.Visible    = true;
                this.dvNoSearchResult.Visible = true;
            }
            else
            {
                this.dvDataContent.Visible  = false;
                this.dvEmptyContent.Visible = true;
                this.btnAddCompany.Visible  = false;
            }

            //this.lblSerchKey.Text = string.Empty;
            this.dataGridCompany.Visible = (lstCompany.Count > 0);
        }
Example #18
0
        /// <summary>
        /// Populate the controls.
        /// </summary>
        private void PopulateControls()
        {
            // Header Text
            this.litHeaderText.Text = this.ActivePage.Heading;

            // Populate distributors dropdown
            List <int> lstDistributors = (new DistributorPriceMarkupBO()).GetAllObject().Where(o => o.Distributor != 0).Select(o => (int)o.Distributor).Distinct().ToList();

            this.ddlDistributors.Items.Add(new ListItem("PLATINUM", "0"));
            foreach (int id in lstDistributors)
            {
                CompanyBO item = new CompanyBO(this.ObjContext);
                item.ID = id;
                item.GetObject();

                this.ddlDistributors.Items.Add(new ListItem(item.Name, item.ID.ToString()));
            }

            if (this.QueryID > 0)
            {
                // Set active pattern ID
                this.hdnPattern.Value = this.QueryID.ToString();

                // Populate active pattern
                this.PopulatePattern();
                //Populate PatternDataGrid
                this.PopulateDataGridPatterns();
            }
            else
            {
                // Populate patterns
                this.PopulateDataGridPatterns();

                this.dgSelectedFabrics.Visible = false;
                this.dvEmptyContent.Visible    = !(this.dgSelectedFabrics.Visible);
            }

            // Populate fabrics
            this.PopulateDataGridFabrics();

            // Page Refresh
            Session["IsRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());

            // Set default values
            ViewState["IsPageValied"]   = true;
            ViewState["PopulatePatern"] = false;
            ViewState["PopulateFabric"] = false;
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            {
                int companyId = int.Parse(hdnSelectedCompanyID.Value.Trim());

                if (companyId > 0)
                {
                    try
                    {
                        using (TransactionScope ts = new TransactionScope())
                        {
                            CompanyBO objCompany = new CompanyBO(this.ObjContext);
                            objCompany.ID = companyId;
                            objCompany.GetObject();

                            List <UserBO> lstUsers = objCompany.UsersWhereThisIsCompany;
                            foreach (UserBO user in lstUsers)
                            {
                                UserBO objUser = new UserBO(this.ObjContext);
                                objUser.ID = user.ID;
                                objUser.GetObject();
                                objUser.Delete();
                            }

                            List <ClientBO> lstClient = objCompany.ClientsWhereThisIsDistributor;
                            foreach (ClientBO client in lstClient)
                            {
                                ClientBO objClient = new ClientBO(this.ObjContext);
                                objClient.ID = client.ID;
                                objClient.GetAllObject();
                                objClient.Delete();
                            }


                            objCompany.Delete();

                            this.ObjContext.SaveChanges();
                            ts.Complete();
                            this.PopulateDataGrid();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
Example #20
0
        /// <summary>
        /// This method calls when page loads
        /// </summary>
        private void PopulateControls()
        {
            this.litHeaderText.Text = "Detail Report";

            CompanyBO objDistributor = new CompanyBO();

            objDistributor.IsDistributor = true;
            List <CompanyBO> lstDist = objDistributor.SearchObjects().OrderBy(m => m.Name).ToList();

            ddlDistributor.Items.Clear();
            ddlDistributor.Items.Add(new ListItem("Select Distributor", "0"));
            foreach (CompanyBO dist in lstDist)
            {
                ddlDistributor.Items.Add(new ListItem(dist.Name, dist.ID.ToString()));
            }
        }
Example #21
0
        public ActionResult SaveCompanyProfile(Company company)
        {
            company.CreatedBy  = USER_ID;
            company.ModifiedBy = USER_ID;
            company.IsActive   = true;

            if (company.CompanyAddress.AddressId == 0)
            {
                company.CompanyAddress.AddressType   = "Company";
                company.CompanyAddress.SeqNo         = 1;
                company.CompanyAddress.AddressLinkID = company.CompanyCode;
            }

            var result       = new CompanyBO().SaveCompany(company);
            var encryptedStr = UrlEncryptionHelper.Encrypt(string.Format("companyCode={0}", company.CompanyCode));

            return(RedirectToAction("CompanyProfile", "Company",
                                    new { q = encryptedStr }));
        }
Example #22
0
        private void ProcessForm()
        {
            //Add User Details
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    UserBO objUser = new UserBO(this.ObjContext);
                    objUser.ID = QueryID;
                    objUser.GetObject();

                    if (objUser.IsDirectSalesPerson)
                    {
                        CompanyBO objDistributor = new CompanyBO(this.ObjContext);
                        objDistributor.Name = "BLACKCHROME - " + objUser.GivenName + " " + objUser.FamilyName;
                        objDistributor      = objDistributor.SearchObjects().SingleOrDefault();

                        if (objDistributor != null)
                        {
                            objDistributor.Name = "BLACKCHROME - " + this.txtFirstName.Text + " " + this.txtLastName.Text;
                        }
                    }

                    objUser.GivenName  = this.txtFirstName.Text;
                    objUser.FamilyName = this.txtLastName.Text;
                    objUser.Password   = UserBO.GetNewEncryptedPassword(this.txtChoosePassword.Text);
                    objUser.Username   = this.txtUserName.Text;
                    objUser.Status     = 1;
                    objUser.IsActive   = true;
                    objUser.IsDeleted  = false;
                    objUser.Guid       = Guid.NewGuid().ToString();

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #23
0
        private void ProcessForm()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    rfvGender.Enabled      = false;
                    rfvCoordinator.Enabled = false;
                    CompanyBO objCompany = new CompanyBO(this.ObjContext);
                    objCompany.ID = this.LoggedUser.Company;
                    objCompany.GetObject();

                    objCompany.Name        = this.txtName.Text;
                    objCompany.NickName    = this.txtNickName.Text;
                    objCompany.Coordinator = int.Parse(this.ddlCoordinator.SelectedValue);
                    LoggedCompany.objCoordinator.GivenName  = txtFirstName.Text;
                    LoggedCompany.objCoordinator.FamilyName = txtLastName.Text;

                    objCompany.Address1 = this.txtAddress1.Text;
                    objCompany.Address2 = this.txtAddress2.Text;
                    objCompany.City     = this.txtCity.Text;
                    objCompany.State    = this.txtState.Text;
                    objCompany.Postcode = this.txtPostcode.Text;
                    objCompany.Country  = int.Parse(this.ddlCountry.SelectedValue);
                    LoggedCompany.objCoordinator.OfficeTelephoneNumber = this.txtPhone1.Text;
                    LoggedCompany.objCoordinator.HomeTelephoneNumber   = this.txtPhone2.Text;
                    LoggedCompany.objCoordinator.MobileTelephoneNumber = this.txtMobile.Text;
                    LoggedCompany.objCoordinator.EmailAddress          = this.txtEmailAddress.Text;
                    //objCompany.Fax = this.txtFaxNo.Text;

                    this.ObjContext.SaveChanges();
                    ts.Complete();
                    this.validationSummary.Visible = !Page.IsValid;
                }
                catch (Exception ex)
                {
                }
            }
        }
Example #24
0
        public ActionResult CompanyProfile(string companyCode = "")
        {
            Company company;

            if (!string.IsNullOrWhiteSpace(companyCode))
            {
                company = new CompanyBO().GetCompany(new Company {
                    CompanyCode = companyCode
                });
            }
            else
            {
                company = new Company();
            }

            company.CountryList = new CountryBO().GetList().Select(c =>
                                                                   new SelectListItem
            {
                Value = c.CountryCode,
                Text  = c.CountryName
            });
            return(View("CompanyProfile", company));
        }
        private void PasteData()
        {
            List <Gen_Company> listofCompany = General.GetQueryable <Gen_Company>(null).ToList();

            objWBView.GetLock();


            int rowsCnt = objWBView.ActiveWorksheet.UsedRange.RowCount;
            int cellCnt = objWBView.ActiveWorksheet.UsedRange.CellCount.ToInt();

            if (cellCnt < 2)
            {
                return;
            }



            try
            {
                grdBookings.RowCount = rowsCnt;
                for (int i = 0; i < rowsCnt; i++)
                {
                    //for (int j = 0; j < 1; j++)
                    //{
                    DateTime pickupdate = objWBView.ActiveWorksheet.Cells[i, 0].Value.ToDateTime();
                    string   vehicle    = objWBView.ActiveWorksheet.Cells[i, 1].Value.ToStr().Trim();



                    string phone     = objWBView.ActiveWorksheet.Cells[i, 2].Value.ToStr().Trim().ToLower();
                    string passenger = objWBView.ActiveWorksheet.Cells[i, 3].Value.ToStr().Trim();
                    string from      = objWBView.ActiveWorksheet.Cells[i, 4].Value.ToStr().Trim().ToLower();
                    string to        = objWBView.ActiveWorksheet.Cells[i, 5].Value.ToStr().Trim();
                    string comment   = objWBView.ActiveWorksheet.Cells[i, 6].Value.ToStr().Trim().ToLower();
                    string account   = objWBView.ActiveWorksheet.Cells[i, 7].Value.ToStr().Trim();



                    if (!string.IsNullOrEmpty(account) && account != "Cash" && listofCompany.Count(c => c.CompanyName.ToLower() == account.ToLower()) == 0)
                    {
                        CompanyBO objCompanyMaster = new CompanyBO();
                        try
                        {
                            objCompanyMaster.New();

                            objCompanyMaster.Current.CompanyName = account;
                            objCompanyMaster.Current.Email       = "*****@*****.**";
                            objCompanyMaster.Current.ContactName = account;
                            objCompanyMaster.Current.Address     = "unknown";
                            objCompanyMaster.Current.TelephoneNo = string.Empty;
                            objCompanyMaster.Current.MobileNo    = string.Empty;
                            objCompanyMaster.Current.WebsiteUrl  = string.Empty;
                            objCompanyMaster.Current.Fax         = string.Empty;

                            objCompanyMaster.Current.IsClosed = false;

                            objCompanyMaster.Current.HasOrderNo       = false;
                            objCompanyMaster.Current.HasPupilNo       = false;
                            objCompanyMaster.Current.AdminFees        = 0;
                            objCompanyMaster.Current.HasComcabCharges = false;

                            objCompanyMaster.Current.DiscountPercentage = 0;

                            objCompanyMaster.Current.FareDeductionPercent = 0;

                            objCompanyMaster.Current.HasVat = false;

                            objCompanyMaster.Current.HasBookedBy = false;

                            objCompanyMaster.Current.CompanyCode = string.Empty;

                            objCompanyMaster.Current.AccountTypeId = Enums.ACCOUNT_TYPE.ACCOUNT;


                            objCompanyMaster.Current.AccountNo        = string.Empty;
                            objCompanyMaster.Current.WebLoginId       = string.Empty;
                            objCompanyMaster.Current.WebLoginPassword = string.Empty;
                            objCompanyMaster.Current.IsWebLoginActive = false;


                            objCompanyMaster.Current.BackgroundColor = string.Empty;
                            objCompanyMaster.Current.TextColor       = string.Empty;
                            objCompanyMaster.Current.PasswordAccount = string.Empty;
                            objCompanyMaster.Current.PasswordEnable  = false;

                            objCompanyMaster.Save();



                            listofCompany.Add(objCompanyMaster.Current);
                        }
                        catch (Exception ex)
                        {
                            if (objCompanyMaster.Errors.Count > 0)
                            {
                                MessageBox.Show(objCompanyMaster.ShowErrors());
                            }

                            break;
                        }
                    }



                    string via      = objWBView.ActiveWorksheet.Cells[i, 8].Value.ToStr().Trim();
                    string flightno = objWBView.ActiveWorksheet.Cells[i, 9].Value.ToStr().Trim();



                    grdBookings.Rows[i].Cells[COLS.PickupDateTime].Value = pickupdate;



                    int vehicleTypeId = General.GetObject <Fleet_VehicleType>(c => c.VehicleType.ToLower() == vehicle.ToLower()).DefaultIfEmpty().Id;

                    if (vehicleTypeId == 0)
                    {
                        vehicleTypeId = AppVars.objPolicyConfiguration.DefaultVehicleTypeId.ToInt();
                    }

                    grdBookings.Rows[i].Cells[COLS.VehicleType].Value = vehicleTypeId;


                    grdBookings.Rows[i].Cells[COLS.PhoneNo].Value   = phone;
                    grdBookings.Rows[i].Cells[COLS.Passenger].Value = passenger;
                    grdBookings.Rows[i].Cells[COLS.From].Value      = from;
                    grdBookings.Rows[i].Cells[COLS.To].Value        = to;
                    grdBookings.Rows[i].Cells[COLS.Notes].Value     = comment;
                    grdBookings.Rows[i].Cells[COLS.Account].Value   = account;



                    grdBookings.Rows[i].Cells[COLS.Via].Value      = via;
                    grdBookings.Rows[i].Cells[COLS.FlightNo].Value = flightno;



                    //   }
                }
            }
            catch (Exception ex)
            {
            }

            finally
            {
                objWBView.ActiveWorksheet.Cells.Delete();

                objWBView.ReleaseLock();
            }
        }
Example #26
0
 public CompanyBO Update(CompanyBO bo)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Populate the controls.
        /// </summary>
        private void PopulateControls()
        {
            this.litHeaderText.Text = this.ActivePage.Heading;

            lblPopupHeaderText.Text           = "New Address";
            ViewState["IsPageValied"]         = true;
            Session["ShipmentAddressDetails"] = null;

            // populate Country
            this.ddlShipToCountry.Items.Clear();
            this.ddlShipToCountry.Items.Add(new ListItem("Select a Country", "0"));
            List <CountryBO> lstCountries = (new CountryBO()).GetAllObject();

            foreach (CountryBO country in lstCountries)
            {
                this.ddlShipToCountry.Items.Add(new ListItem(country.ShortName, country.ID.ToString()));
            }

            //populate Ports
            this.ddlShipToPort.Items.Clear();
            this.ddlShipToPort.Items.Add(new ListItem("Select a Port", "0"));
            List <DestinationPortBO> lstDestinationPorts = (new DestinationPortBO()).GetAllObject();

            foreach (DestinationPortBO port in lstDestinationPorts)
            {
                this.ddlShipToPort.Items.Add(new ListItem(port.Name, port.ID.ToString()));
            }

            //populate clients
            //this.ddlClient.Items.Clear();
            //this.ddlClient.Items.Add(new ListItem("Select a Client", "0"));

            //ClientBO objClient = new ClientBO();
            //List<ClientBO> lstClients = objClient.SearchObjects().OrderBy(o => o.Name).ToList();

            this.RadGridShipmentAddress.MasterTableView.GetColumn("CountryID").Display     = false;
            this.RadGridShipmentAddress.MasterTableView.GetColumn("PortID").Display        = false;
            this.RadGridShipmentAddress.MasterTableView.GetColumn("ClientID").Display      = false;
            this.RadGridShipmentAddress.MasterTableView.GetColumn("DistributorID").Display = false;
            this.RadGridShipmentAddress.MasterTableView.GetColumn("AddressTypeID").Display = false;

            //if (this.LoggedUser.IsDirectSalesPerson)
            //{
            //    lstClients = lstClients.Where(m => m.Distributor == this.Distributor.ID).ToList();
            //}
            //if (this.LoggedUser.IsDirectSalesPerson)
            //{
            //    this.dvDistributor.Attributes.Add("style", "display:none");
            //}
            //else if (this.LoggedUserRoleName == UserRole.IndicoAdministrator || this.LoggedUserRoleName == UserRole.IndicoCoordinator)
            //{
            //    lstClients = lstClients.Where(m => m.objDistributor.Coordinator == this.LoggedUser.ID).ToList();
            //}

            //foreach (ClientBO client in lstClients)
            //{
            //    this.ddlClient.Items.Add(new ListItem(client.Name, client.ID.ToString()));
            //}

            // Populate Distributors
            this.ddlDistributor.Items.Clear();
            this.ddlDistributor.Items.Add(new ListItem("Select a Distributor", "0"));

            CompanyBO objDistributor = new CompanyBO();

            objDistributor.IsDistributor = true;
            List <CompanyBO> lstDistributors = new List <CompanyBO>();

            if (this.LoggedUser.IsDirectSalesPerson)
            {
                objDistributor.ID = this.Distributor.ID;
                lstDistributors   = objDistributor.SearchObjects();
            }
            else if (LoggedUserRoleName == UserRole.DistributorAdministrator || LoggedUserRoleName == UserRole.DistributorCoordinator)
            {
                lstDistributors = objDistributor.SearchObjects();
            }
            else
            {
                lstDistributors = objDistributor.SearchObjects();
            }

            lstDistributors = lstDistributors.OrderBy(m => m.Name).ToList();

            foreach (CompanyBO distributor in lstDistributors)
            {
                this.ddlDistributor.Items.Add(new ListItem(distributor.Name, distributor.ID.ToString()));
            }

            if (this.LoggedUser.IsDirectSalesPerson)
            {
                this.ddlDistributor.Items.FindByValue(this.Distributor.ID.ToString()).Selected = true;
                this.ddlDistributor.Enabled = false;
            }

            //Populate Address Type
            this.ddlAdderssType.Items.Clear();
            this.ddlAdderssType.Items.Add(new ListItem("Select an Address Type", "-1"));
            int addressType = 0;

            foreach (AddressType type in Enum.GetValues(typeof(AddressType)))
            {
                this.ddlAdderssType.Items.Add(new ListItem(type.ToString(), addressType++.ToString()));
            }

            this.PopulateDataGrid();
        }
        private int ProcessForm()
        {
            int distributor = 0;

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    CompanyBO objDistributor = new CompanyBO(this.ObjContext);
                    if (this.QueryID > 0)
                    {
                        objDistributor.ID = this.QueryID;
                        objDistributor.GetObject();
                    }
                    else
                    {
                        objDistributor.Creator     = this.LoggedUser.ID;
                        objDistributor.CreatedDate = DateTime.Now;
                        objDistributor.IsActive    = true;
                        objDistributor.IsDelete    = false;
                    }
                    objDistributor.Modifier     = this.LoggedUser.ID;
                    objDistributor.ModifiedDate = DateTime.Now;

                    objDistributor.Type          = 4; //Distributor
                    objDistributor.IsDistributor = true;
                    objDistributor.Name          = this.txtName.Text;
                    objDistributor.NickName      = this.txtNickName.Text;
                    objDistributor.Number        = this.txtCompanyNumber.Text;
                    objDistributor.Address1      = this.txtAddress1.Text;
                    objDistributor.Address2      = this.txtAddress2.Text;
                    objDistributor.City          = this.txtCity.Text;
                    objDistributor.State         = this.txtState.Text;
                    objDistributor.Postcode      = this.txtPostalCode.Text;
                    objDistributor.Country       = int.Parse(this.ddlCountry.SelectedValue);
                    objDistributor.Phone1        = this.txtPhoneNo1.Text;
                    objDistributor.Phone2        = this.txtPhoneNo2.Text;
                    objDistributor.Fax           = this.txtFaxNo.Text;
                    //objDistributor.Email = this.txtEmailAddress.Text;
                    objDistributor.Coordinator = int.Parse(ddlCoordinator.SelectedValue);
                    //objDistributor.SecondaryCoordinator = int.Parse(this.ddlSecondaryCoordinator.SelectedValue);
                    objDistributor.IsBackOrder = this.chkBackOrder.Checked;
                    objDistributor.IsActive    = this.chkIsActive.Checked;



                    ObjContext.SaveChanges();

                    //distributor = objDistributor.ID;

                    //var objDca = new DistributorClientAddressBO()
                    //{
                    //    CompanyName = "TBA",
                    //    Address = "TBA",
                    //    Suburb = "TBA",
                    //    PostCode = "TBA",
                    //    Country = 14,
                    //    ContactName = "TBA",
                    //    ContactPhone = "TBA",
                    //    State = "TBA",
                    //    EmailAddress = "TBA",
                    //    AddressType = 0,
                    //    Distributor = objDistributor.ID,
                    //    IsAdelaideWarehouse = false
                    //};

                    //objDca.Add();

                    //ObjContext.SaveChanges();

                    //UserBO objUser = null;
                    //if (this.QueryID == 0)
                    //{
                    //    objUser = new UserBO(this.ObjContext);
                    //    objUser.Company = distributor;

                    //    objUser.IsDistributor = true;
                    //    objUser.Status = 3; //Invited
                    //    objUser.Username = this.txtEmailAddress.Text;
                    //    objUser.Password = UserBO.GetNewEncryptedRandomPassword();
                    //    objUser.GivenName = this.txtGivenName.Text;
                    //    objUser.FamilyName = this.txtFamilyName.Text;
                    //    objUser.EmailAddress = this.txtEmailAddress.Text;
                    //    objUser.Creator = this.LoggedUser.ID;
                    //    objUser.CreatedDate = DateTime.Now;
                    //    objUser.HomeTelephoneNumber = this.txtPhoneNo1.Text;
                    //    objUser.OfficeTelephoneNumber = this.txtPhoneNo2.Text;
                    //    objUser.Modifier = this.LoggedUser.ID;
                    //    objUser.ModifiedDate = DateTime.Now;
                    //    objUser.Guid = Guid.NewGuid().ToString();

                    //    RoleBO objRole = new RoleBO(this.ObjContext);
                    //    objRole.ID = 10; // Distributor Administrator
                    //    objRole.GetObject();

                    //    objUser.UserRolesWhereThisIsUser.Add(objRole);
                    //    objUser.CompanysWhereThisIsOwner.Add(objDistributor);

                    //    this.ObjContext.SaveChanges();

                    //    //Send Invitation Email
                    //    string hosturl = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/";
                    //    string emailcontent = String.Format("<p>A new acoount set up for u at <a href =\"http://{0}\">\"http://{0}/</a></p>" +
                    //                                        "<p>To complete your registration simply clik the link below to sign in<br>" +
                    //                                        "<a href=\"http://{0}Welcome.aspx?guid={1}&id={2}\">http://{0}Welcome.aspx?guid={1}&id={2}</a></p>",
                    //                                        hosturl, objUser.Guid, objUser.ID.ToString());

                    //    IndicoEmail.SendMailNotifications(this.LoggedUser, objUser, "Activate Your New Account", emailcontent);
                    //}
                    //else
                    //{
                    //    if (!objDistributor.Name.Contains("BLACKCHROME"))
                    //    {
                    //        objUser = new UserBO(this.ObjContext);
                    //        objUser.ID = (int)objDistributor.Owner;
                    //        objUser.GetObject();

                    //        objUser.GivenName = this.txtGivenName.Text;
                    //        objUser.FamilyName = this.txtFamilyName.Text;
                    //        objUser.EmailAddress = this.txtEmailAddress.Text;

                    //        ObjContext.SaveChanges();
                    //    }
                    //}
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                IndicoLogging.log.Error("Error occured while send Distributor email", ex);
            }

            return(distributor);
        }
        /// <summary>
        /// Populate the controls.
        /// </summary>
        private void PopulateControls()
        {
            // Header Text
            this.litHeaderText.Text = ((this.QueryID > 0) ? "Edit " : "New ") + this.ActivePage.Heading;

            // Populate Country
            this.ddlCountry.Items.Add(new ListItem("Select Your Country", "0"));
            List <CountryBO> lstCountry = (new CountryBO()).GetAllObject().AsQueryable().OrderBy("ShortName").ToList();

            foreach (CountryBO country in lstCountry)
            {
                this.ddlCountry.Items.Add(new ListItem(country.ShortName, country.ID.ToString()));
            }

            // Populate Primary Coordinator
            this.ddlCoordinator.Items.Add(new ListItem("Select Your Primary Coordinator", "0"));
            List <UserBO> lstCoordinator = (from co in new UserBO().GetAllObject().AsQueryable().OrderBy("GivenName").ToList()
                                            where co.objCompany.Type == 3
                                            select co).ToList();

            foreach (UserBO coordinator in lstCoordinator)
            {
                this.ddlCoordinator.Items.Add(new ListItem(coordinator.GivenName + " " + coordinator.FamilyName, coordinator.ID.ToString()));
            }

            if (this.LoggedUserRoleName == UserRole.IndicoAdministrator || this.LoggedUserRoleName == UserRole.IndicoCoordinator)
            {
                this.ddlCoordinator.ClearSelection();
                this.ddlCoordinator.SelectedValue = this.LoggedUser.ID.ToString();
                this.ddlCoordinator.Enabled       = false;
            }

            // Populate Secondary Coordinator
            //this.ddlSecondaryCoordinator.Items.Add(new ListItem("Select Your Secondary Coordinator", "0"));
            //List<UserBO> lstSecondaryCoordinator = (from co in new UserBO().GetAllObject().AsQueryable().OrderBy("GivenName").ToList()
            //                                        where co.objCompany.Type == 3
            //                                        select co).ToList();
            //foreach (UserBO coordinator in lstSecondaryCoordinator)
            //{
            //    this.ddlSecondaryCoordinator.Items.Add(new ListItem(coordinator.GivenName + " " + coordinator.FamilyName, coordinator.ID.ToString()));
            //}

            if (QueryID > 0)
            {
                CompanyBO objDistributor = new CompanyBO();
                objDistributor.ID = this.QueryID;
                objDistributor.GetObject();

                this.txtName.Text             = objDistributor.Name;
                this.txtCompanyNumber.Text    = objDistributor.Number;
                this.txtNickName.Text         = objDistributor.NickName;
                this.txtAddress1.Text         = objDistributor.Address1;
                this.txtAddress2.Text         = objDistributor.Address2;
                this.txtCity.Text             = objDistributor.City;
                this.txtState.Text            = objDistributor.State;
                this.txtPostalCode.Text       = objDistributor.Postcode;
                this.ddlCountry.SelectedValue = objDistributor.Country.ToString();
                this.txtPhoneNo1.Text         = objDistributor.Phone1;
                this.txtPhoneNo2.Text         = objDistributor.Phone2;
                this.txtFaxNo.Text            = objDistributor.Fax;
                this.chkBackOrder.Checked     = objDistributor.IsBackOrder ?? false;
                this.chkIsActive.Checked      = objDistributor.IsActive ?? false;

                // populate owner details
                //if (objDistributor.Name.Contains("BLACKCHROME"))
                //{
                //    this.dvUser.Visible = false;
                //}
                //else
                //{
                //    this.txtGivenName.Text = objDistributor.objOwner.GivenName;
                //    this.txtFamilyName.Text = objDistributor.objOwner.FamilyName;
                //    this.txtEmailAddress.Text = objDistributor.objOwner.EmailAddress;
                //}

                this.ddlCoordinator.SelectedValue = objDistributor.Coordinator.ToString();
                //this.ddlSecondaryCoordinator.SelectedValue = objDistributor.SecondaryCoordinator.ToString();
            }
            else
            {
                this.ddlCountry.SelectedValue = this.ddlCountry.Items.FindByValue("14").Value;
            }
        }
Example #30
0
        public PartialViewResult GetCompanies()
        {
            var companyList = new CompanyBO().GetList();

            return(PartialView(companyList));
        }