Exemplo n.º 1
0
        private void LoadLicenseExpDate()
        {
            WarnContentText.InnerHtml = "";
            Company company = companyService.GetCompany(Convert.ToInt32(Session["CompanyID"]));

            foreach (var license in company.CompanyLicense)
            {
                DateTime CurrentDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
                DateTime ExpiryDate  = Convert.ToDateTime(license.ExpiryDate);
                TimeSpan difference  = ExpiryDate - CurrentDate;
                if (Convert.ToInt32(license.NotificationDays) >= difference.TotalDays)
                {
                    if (difference.TotalDays <= 0)
                    {
                        WarnContent.Visible        = true;
                        WarnContentText.InnerHtml += "\n" + license.Product + " Expired | ";
                    }
                    else
                    {
                        WarnContent.Visible        = true;
                        WarnContentText.InnerHtml += "\n" + license.Product + " Expires in " + difference.TotalDays + " days | ";
                    }
                }
            }
        }
Exemplo n.º 2
0
        public ViewResult Update(int id)
        {
            Company             company        = _employRepo.GetCompany(id);
            employmentViewModel employmentView = new employmentViewModel()
            {
                compy_name    = company.CompName,
                Address       = company.Address,
                contactPerson = company.ContactPerson,
                compy_id      = company.ID
            };

            return(View(employmentView));
        }
        protected void txt_CompId_TextChanged(object sender, EventArgs e)
        {
            int     CompanyId = Convert.ToInt32(txt_CompId.Text);
            Company company   = companyService.GetCompany(CompanyId);

            txt_CompName.Text = company.CompanyName;
            txt_Address.Text  = company.CompanyAddress;
            txt_Country.Text  = company.CompanyCountry;
            txt_City.Text     = company.CompanyCity;
            txt_Zip.Text      = company.CompanyZip;

            txt_Email.Text     = company.CompanyEmail;
            txt_Telephone.Text = company.CompanyTelephone;

            txt_userid.Text   = company.CompanyUserid;
            txt_password.Text = company.CompanyPassword;

            foreach (var licenses in company.CompanyLicense)
            {
                var Product = licenses.Product;
                if (Product.Equals("Inventory"))
                {
                    txt_InventoryKey.Text = licenses.LicenseKey;
                }
                else if (Product.Equals("Purchase"))
                {
                    txt_PurchaseKey.Text = licenses.LicenseKey;
                }
                else
                {
                    txt_SaleKey.Text = licenses.LicenseKey;
                }
            }
        }
        public IEnumerable <CompanyVm> BlGetAllCompany()
        {
            var getData       = _CompanyRepository.GetCompany();
            var randomCompany = Mapper.Map <IEnumerable <Company>, IEnumerable <CompanyVm> >(getData);

            return(randomCompany);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtCompany.Attributes.Add("ReadOnly", "true");

            //Adding  columns to datatable
            dataTable.Columns.Add("USER_ID");
            dataTable.Columns.Add("COMPANY_ID");
            dataTable.Columns.Add("USER_NAME");
            dataTable.Columns.Add("USER_PASSWORD");
            dataTable.Columns.Add("NAME");
            dataTable.Columns.Add("DEPARTMENT_ID");
            dataTable.Columns.Add("ROLE_ID");
            dataTable.Columns.Add("ISACTIVE");
            dataTable.Columns.Add("CREATED_DATE");
            dataTable.Columns.Add("MODIFIED_DATE");
            LoadGridTable();

            if (!Page.IsPostBack)
            {
                Company company = companyService.GetCompany(Convert.ToInt32(Session["CompanyID"]));
                txtCompany.Text = company.CompanyName;
                LoadDepartment();
            }
        }
        private void LoadUserData()
        {
            ddlDepartment.Items.Clear();

            if (Convert.ToBoolean(Session["IsAdmin"]))
            {
                Company           company     = companyService.GetCompany(Convert.ToInt32(Session["CompanyID"]));
                List <Department> departments = departmentService.GetDepartment();
                foreach (var department in departments)
                {
                    ddlDepartment.Items.Add(new ListItem(department.Department_Description, department.Id.ToString()));
                }
                txtRequesterName.Text = company.CompanyName;
            }
            else
            {
                Users      usersModel = usersService.GetUsers(Convert.ToInt32(Session["UserID"]));
                Department department = departmentService.GetDepartment(usersModel.Department_Id);
                ddlDepartment.Items.Add(new ListItem(department.Department_Description, department.Id.ToString()));
                txtRequesterName.Text = usersModel.Name;
            }
        }
        // GET: Company

        public ActionResult Index()
        {
            return(View(companyRepository.GetCompany()));
        }
 protected void btnLogin_ServerClick(object sender, EventArgs e)
 {
     Session["IsNewUser"] = "******";
     if (txt_UserName.Text == "admin" && txt_Password.Text == "admin")
     {
         Session["IsAdmin"]   = true;
         Session["UserID"]    = null;
         Session["CompanyID"] = null;
         Session["IsNewUser"] = "******";
         Response.Redirect("Pages/Dashboard.aspx");
     }
     else if (chkAdmin.Checked)
     {
         string Result = userService.CheckAdminLogin(txt_UserName.Text, txt_Password.Text);
         if (Result.Equals("UNAUTHORIZED"))
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed",
                                                     "alert('Invalid Credentials');", true);
         }
         else
         {
             Company company = companyService.GetCompany(Convert.ToInt32(Result));
             Session["UserID"]    = company.Id;
             Session["CompanyID"] = company.Id;
             Session["IsAdmin"]   = true;
             if (CheckLimit(company.Id, company.Id))
             {
                 Response.Redirect("Pages/Dashboard.aspx");
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed",
                                                         "alert('Maximum Number of Users Exceeded');", true);
             }
         }
     }
     else
     {
         string Result = userService.CheckUserLogin(txt_UserName.Text, txt_Password.Text);
         if (Result.Equals("UNAUTHORIZED"))
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed",
                                                     "alert('Invalid Credentials');", true);
         }
         else
         {
             Users users = userService.GetUsers(Convert.ToInt32(Result));
             Session["UserID"]    = users.User_Id;
             Session["CompanyID"] = users.Company_Id;
             Session["IsAdmin"]   = false;
             if (CheckLimit(users.User_Id, users.Company_Id))
             {
                 Response.Redirect("Pages/Dashboard.aspx");
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed",
                                                         "alert('Maximum Number of Users Exceeded');", true);
             }
         }
     }
 }