Exemplo n.º 1
0
        public JsonResult GetUserList()
        {
            AdminBAL bal      = new AdminBAL();
            var      userList = bal.GetUserList();

            return(Json(new { data = userList }, JsonRequestBehavior.AllowGet));
        }
        public void GetData()
        {
            AdminBAL  resourceList = new AdminBAL();
            DataTable _data        = resourceList.AdminResourceTable();

            grdResourceList.DataSource = _data;
            grdResourceList.DataBind();
        }
        public ActionResult Home()
        {
            if (Session["Id"] == null)
            {
                return(RedirectToAction("Login"));
            }
            List <UserDTO> userDTOs = AdminBAL.GetAllUsers();

            return(View(userDTOs));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Do Admin Login
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public AdminModel DoLogin(string userName, string password)
 {
     try
     {
         return(AdminBAL.AdminLogin(userName, password));
     }
     catch (Exception exc)
     {
         throw new FaultException <FuneralServiceFault>(new FuneralServiceFault(exc.Message));
     }
 }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AdminBAL  _skillList = new AdminBAL();
                DataTable skill      = _skillList.AdminSkillList();

                DropDownSkills.DataSource     = skill;
                DropDownSkills.DataValueField = "sk_code";
                DropDownSkills.DataTextField  = "sk_name";
                DropDownSkills.DataBind();
            }
        }
    public void fillAdminGridview()
    {
        AdminBAL  balAdmin = new AdminBAL();
        DataTable dt       = new DataTable();

        dt = balAdmin.SelectAll();

        if (dt != null && dt.Rows.Count > 0)
        {
            gvAdmin.DataSource = dt;
            gvAdmin.DataBind();
        }
    }
 public ActionResult Login(string login, string password)
 {
     if (!AdminBAL.ValidateAdmin(login, password))
     {
         List <string> messages = new List <string>();
         messages.Add("Login/Password combination doesn't match.");
         ViewBag.Login    = login;
         ViewBag.Password = password;
         ViewBag.Status   = false;
         ViewBag.Messages = messages;
         return(View());
     }
     Session["Id"]    = AdminBAL.GetIdByLogin(login);
     Session["Login"] = login;
     return(RedirectToAction("Home"));
 }
Exemplo n.º 8
0
        public void GetData()
        {
            try
            {
                AdminBO _skillDataBO = new AdminBO
                {
                    ResCode = RCodeTextBox.Text
                };
                AdminBAL  _skillDataBAL = new AdminBAL();
                DataTable tableSkill    = _skillDataBAL.AdminSkillData(_skillDataBO);
                DataRow   dr            = tableSkill.Rows[0];
                if (dr == null)
                {
                    lblStatus.Text = "Resource Code Does Not exist";
                }
                else
                {
                    HiddenField1.Value        = RCodeTextBox.Text;
                    lblResourceDesc.Text      = dr["res_description"].ToString();
                    gridViewSkills.DataSource = tableSkill;
                    gridViewSkills.DataBind();

                    DropDownIntendedAud.Items.Add(dr["skRes_audience"].ToString());
                    ArrayList audience = new ArrayList {
                        "Student", "Teacher", "Both"
                    };
                    foreach (string k in audience)
                    {
                        DropDownIntendedAud.Items.Add(k);
                    }
                    dropDownBoxComp.Items.Add(dr["skRes_compLevel"].ToString());
                    ArrayList comp = new ArrayList {
                        "Beginner", "Intermediate", "Advance"
                    };
                    foreach (string k in comp)
                    {
                        dropDownBoxComp.Items.Add(k);
                    }
                }
            }
            catch (Exception ex)
            {
                lblStatus.Text = "Resource Code Does Not exist exception";
            }
        }
 protected void grdResourceList_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         GridViewRow row        = grdResourceList.Rows[e.RowIndex];
         string      res_Code   = (row.FindControl("lblResCode") as Label).Text;
         string      skill_name = (row.FindControl("lblSkills") as Label).Text;
         AdminBO     deleteBO   = new AdminBO
         {
             ResCode   = res_Code,
             SkillName = skill_name
         };
         AdminBAL deleteBAL = new AdminBAL();
         int      result    = deleteBAL.AdminDeleteResource(deleteBO);
     }
     catch (Exception ex)
     {
     }
     GetData();
 }
Exemplo n.º 10
0
        public JsonResult AddUpdateUser(UserDetails userDetails)
        {
            bool result = true;

            try
            {
                if (userDetails.ID == 0)
                {
                    AdminBAL bal = new AdminBAL();
                    result = bal.AddUserDetails(userDetails);
                }
                else
                {
                    //Todo: Call Update customer Bal
                }
            }
            catch
            {
                result = false;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["_resCode"] != null)
            {
                RCodeTextBox.Text  = Request.QueryString["_resCode"];
                HiddenField1.Value = RCodeTextBox.Text;
                GetData();
            }

            if (!IsPostBack)
            {
                AdminBAL  _skillList = new AdminBAL();
                DataTable skill      = _skillList.AdminSkillList();

                dropDownSkills.DataSource     = skill;
                dropDownSkills.DataValueField = "sk_name";
                dropDownSkills.DataTextField  = "sk_name";

                dropDownSkills.DataBind();
                dropDownSkills.Items.Insert(skill.Rows.Count, new ListItem {
                    Text = "Others", Value = "Others"
                });
            }
        }
Exemplo n.º 12
0
        public JsonResult AddUpdateCustomer(Customer customer)
        {
            bool result = true;

            try
            {
                if (customer.ID == 0)
                {
                    AdminBAL bal = new AdminBAL();
                    result = bal.AddCustomer(customer);
                }
                else
                {
                    //Todo: Call Update customer Bal
                }
            }
            catch
            {
                result = false;
            }


            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //if (DocUpload.HasFile)
                //{
                //    string strExtension = System.IO.Path.GetExtension(DocUpload.FileName);
                //if (strExtension == ".docx" || strExtension == ".docm" || strExtension == ".pdf" || strExtension == ".xlsx" || strExtension == ".xlsm")
                //{
                AdminBAL _resourcesBAL = new AdminBAL();          //d

                //string strname = DocUpload.FileName.ToString();
                //string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
                //DocUpload.SaveAs(Server.MapPath("~/Document/") + fileName + strname);
                //string filename = System.IO.Path.GetFileName(DocUpload.FileName);



                AdminBO _addResources = new AdminBO           //d
                {
                    ResCode        = RCodeTextBox.Text,
                    ResDescription = RDesTextBox.Text,
                    // ResDocument = "~/Document/" + fileName + strname
                };

                int result = _resourcesBAL.AdminAddResources(_addResources);

                if (result >= 1)
                {
                    int result_skill = 1;

                    if (AddSkill.SelectedValue == "Yes")
                    {
                        AdminBO _addResourceSkills = new AdminBO            //d
                        {
                            ResCode   = RCodeTextBox.Text,
                            SkillName = DropDownSkills.SelectedItem.Text,
                            CompLevel = DropDownCompetency.SelectedItem.Value,
                            Audience  = DropDownIntendedAud.SelectedItem.Value
                        };

                        result_skill = _resourcesBAL.AdminAddResourceSkill(_addResourceSkills);

                        if (result_skill >= 1)
                        {
                            lblFail.Text = "Resource Added Successfully";
                            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ResourceAdded();", true);
                        }

                        else
                        {
                            AdminBO delete = new AdminBO
                            {
                                ResCode = RCodeTextBox.Text
                            };

                            _resourcesBAL.AdminDeleteList(delete);
                            lblFail.Text = "Deleted Failed";
                        }
                    }
                    else
                    {
                        lblFail.Text = "Resource Added Successfully";
                        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ResourceAdded();", true);
                    }
                }
                else
                {
                    lblFail.Text = "Resource Code already Exists!";
                }



                //}
                //else
                //{
                //    lblFail.Text = "Plz upload a valid document!!!!";
                //}
                //}
                //else
                //{
                //    lblFail.Text = "Plz upload !!!!";
                //}
            }
            catch (Exception ex)
            {
                lblFail.Text = ex.ToString();
            }
        }
 public string DeleteAdmin(string id)
 {
     return(AdminBAL.DeleteAdmin(id));
 }
 public string UpdateAdmin(string lastID, string id, string name, string lastName, string password)
 {
     return(AdminBAL.UpdateAdmin(lastID, id, name, lastName, password));
 }
 public string InsertTrashCan(string userName, string lastName, string password, string longitude, string latitude, string currentTrash, string wishTrash)
 {
     return(AdminBAL.InsertTrashCan(userName, lastName, password, longitude, latitude, currentTrash, wishTrash));
 }
 public string InsertAdmin(string id, string name, string lastName, string password)
 {
     return(AdminBAL.InsertAdmin(id, name, lastName, password));
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region server side validation
        String strErrorMessage = "";

        if (txtAdminName.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Admin Name <br/>";
        }
        if (txtAddress.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Address <br/>";
        }
        if (txtEmail.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Email <br/>";
        }
        if (txtMobile.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Mobile <br/>";
        }
        if (Request.QueryString["AdminID"] == null)
        {
            if (txtUserName.Text.Trim() == "")
            {
                strErrorMessage += "- Enter UserName <br/>";
            }
            if (txtPassword.Text.Trim() == "")
            {
                strErrorMessage += "- Enter Password <br/>";
            }
            if (txtReTypePassword.Text.Trim() == "")
            {
                strErrorMessage += "- Re-type Password <br/>";
            }

            if (txtPassword.Text.Trim() != txtReTypePassword.Text.Trim())
            {
                strErrorMessage += "- Password & Re-type Password must be Same.<br/>";
            }
        }
        if (strErrorMessage.Trim() != "")
        {
            lblErrorMessage.Text = strErrorMessage;
            return;
        }
        else
        {
            lblErrorMessage.Text = "";
        }
        #endregion server side validation

        #region Collect Form Data
        AdminENT entAdmin        = new AdminENT();
        String   strLogicalPath  = "~/UploadedData/Images/Admin/";
        String   strPhysicalPath = "";

        if (txtAdminName.Text.Trim() != "")
        {
            entAdmin.AdminName = txtAdminName.Text.Trim();
        }
        if (txtAddress.Text.Trim() != "")
        {
            entAdmin.Address = txtAddress.Text.Trim();
        }
        if (txtEmail.Text.Trim() != "")
        {
            entAdmin.Email = txtEmail.Text.Trim();
        }
        if (txtMobile.Text.Trim() != "")
        {
            entAdmin.Mobile = txtMobile.Text.Trim();
        }

        if (fuAdminImage.HasFile)
        {
            strPhysicalPath = Server.MapPath(strLogicalPath) + fuAdminImage.FileName;

            if (File.Exists(strPhysicalPath))
            {
                File.Delete(strPhysicalPath);
            }

            fuAdminImage.SaveAs(strPhysicalPath);

            entAdmin.AdminImage = strLogicalPath + fuAdminImage.FileName;
        }
        else
        {
            entAdmin.AdminImage = "~/UploadedData/Images/Admin/avatar.png";
        }

        if (txtUserName.Text.Trim() != "")
        {
            entAdmin.UserName = txtUserName.Text.Trim();
        }
        if (txtPassword.Text.Trim() != "")
        {
            entAdmin.Password = txtPassword.Text.Trim();
        }
        #endregion Collect Form Data

        AdminBAL balAdmin = new AdminBAL();

        if (Request.QueryString["AdminID"] == null)
        {
            if (balAdmin.Insert(entAdmin))
            {
                ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'Admin Inserted Successfully', showConfirmButton: false, timer: 2000});", true);
                ClearControls();
            }
            else
            {
                lblErrorMessage.Text = balAdmin.Message;
            }
        }
        else
        {
        }
    }
Exemplo n.º 19
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (dropDownSkills.Text == "Others")
                {
                    {
                        if (txtBoxSkill.Text.Length >= 1)
                        {
                            AdminBO _addSkill = new AdminBO
                            {
                                NewSkill = txtBoxSkill.Text
                            };
                            AdminBAL _addSkillBAL = new AdminBAL();
                            int      result       = _addSkillBAL.AdminAddNewSkill(_addSkill);
                            if (result >= 1)
                            {
                                AdminBO _skillMappingBO = new AdminBO
                                {
                                    ResCode = RCodeTextBox.Text,

                                    Audience  = DropDownIntendedAud.Text,
                                    CompLevel = dropDownBoxComp.Text,
                                    SkillName = txtBoxSkill.Text
                                };
                                AdminBAL _skillMappingBAL = new AdminBAL();
                                int      result_Map       = _skillMappingBAL.AdminSkillMapping(_skillMappingBO);
                                if (result_Map >= 1)
                                {
                                    lblStatus.Text = "Skill Mapped Successfully";
                                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "Skillsadded();", true);
                                }
                                else
                                {
                                }
                            }
                            else
                            {
                                lblStatus.Text = "Skill Already Exist Please Select from Drop Down";
                            }
                        }
                        else
                        {
                            lblStatus.Text = "Please Enter new Skill Name";
                        }
                    }
                }
                else
                {
                    AdminBO _skillMappingBO = new AdminBO
                    {
                        ResCode   = RCodeTextBox.Text,
                        Audience  = DropDownIntendedAud.Text,
                        CompLevel = dropDownBoxComp.Text,
                        SkillName = dropDownSkills.Text
                    };
                    AdminBAL _skillMappingBAL = new AdminBAL();
                    int      result_Map       = _skillMappingBAL.AdminSkillMapping(_skillMappingBO);
                    if (result_Map >= 1)
                    {
                        lblStatus.Text = "Skills Mapped Successfully";
                        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "Skillsadded();", true);
                    }
                    else
                    {
                        lblStatus.Text = "Upload Mapping Wt Unsuccessfull";
                    }
                }

                if (Request.QueryString["_resCode"] != null)
                {
                    // Response.Redirect("~/ResourceList.aspx");
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "SkillMapped();", true);
                }
                else
                {
                    lblStatus.Text = "Something went wrong.Please try again.";
                }
            }
            catch (Exception ex)
            {
                lblStatus.Text = "Skill Already Exist Exception";
            }
        }
 public string AdminsList()
 {
     return(AdminBAL.AdminsList());
 }
 public string DeleteDriver(string id)
 {
     return(AdminBAL.DeleteDriver(id));
 }
 public string UpdateDriver(string lastID, string id, string name, string lastName, string password, string longitude, string latitude)
 {
     return(AdminBAL.UpdateDriver(lastID, id, name, lastName, password, longitude, latitude));
 }
 public string DeleteTrashCan(string userName)
 {
     return(AdminBAL.DeleteTrashCan(userName));
 }
Exemplo n.º 24
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        #region Server Side Validation
        String strErrorMessage = "";

        if (txtUserName.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Username <br/>";
        }

        if (txtPassword.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Password <br/>";
        }

        if (strErrorMessage != "")
        {
            lblErrorMessage.Text = strErrorMessage;
            return;
        }
        else
        {
            lblErrorMessage.Text = "";
        }
        #endregion Server Side Validation

        #region Read Data
        SqlString UserName = SqlString.Null;
        SqlString Password = SqlString.Null;

        if (txtUserName.Text != "")
        {
            UserName = txtUserName.Text.ToString().Trim();
        }

        if (txtPassword.Text != "")
        {
            Password = txtPassword.Text.ToString().Trim();
        }
        #endregion Read Data

        if (Request.QueryString["user"] == "admin" || Convert.ToBoolean(Application["CheckAdmin"]) == true)
        {
            AdminBAL balAdmin = new AdminBAL();
            AdminENT entAdmin = new AdminENT();

            entAdmin = balAdmin.SelectByUserNamePassword(UserName, Password);

            if (!entAdmin.AdminID.IsNull)
            {
                if (!entAdmin.AdminID.IsNull)
                {
                    Session["UserID"] = Convert.ToString(entAdmin.AdminID.Value);
                }

                if (!entAdmin.UserName.IsNull)
                {
                    Session["UserName"] = Convert.ToString(entAdmin.UserName.Value);
                }

                if (!entAdmin.AdminImage.IsNull)
                {
                    Session["UserImage"] = Convert.ToString(entAdmin.AdminImage.Value);
                }

                string ReturnUrl = Convert.ToString(Request.QueryString["url"]);

                if (!string.IsNullOrEmpty(ReturnUrl))
                {
                    Response.Redirect(ReturnUrl);
                }
                else
                {
                    Response.Redirect("~/AdminPanel/Dashboard.aspx");
                }
            }
            else
            {
                lblErrorMessage.Text = "Eithe Username or password is Invalid, Try again...!";
            }
        }
        else if (Request.QueryString["user"] == "doctor" || Convert.ToBoolean(Application["CheckDoctor"]) == true)
        {
            DoctorBAL balDoctor = new DoctorBAL();
            DoctorENT entDoctor = new DoctorENT();

            entDoctor = balDoctor.SelectByUserNamePassword(UserName, Password);

            if (!entDoctor.DoctorID.IsNull)
            {
                if (!entDoctor.DoctorID.IsNull)
                {
                    Session["UserID"] = Convert.ToString(entDoctor.DoctorID.Value);
                }

                if (!entDoctor.DoctorName.IsNull)
                {
                    Session["UserName"] = Convert.ToString(entDoctor.DoctorName.Value);
                }

                if (!entDoctor.DoctorImage.IsNull)
                {
                    Session["UserImage"] = Convert.ToString(entDoctor.DoctorImage.Value);
                }

                if (!entDoctor.DepartmentID.IsNull)
                {
                    DepartmentENT entDepartment = new DepartmentENT();
                    DepartmentBAL balDepartment = new DepartmentBAL();

                    entDepartment             = balDepartment.SelectByPK(Convert.ToInt32(entDoctor.DepartmentID.Value));
                    Session["DepartmentName"] = entDepartment.DepartmentName.Value;
                }

                string ReturnUrl = Convert.ToString(Request.QueryString["url"]);

                if (!string.IsNullOrEmpty(ReturnUrl))
                {
                    Response.Redirect(ReturnUrl);
                }
                else
                {
                    Response.Redirect("~/AdminPanel/Dashboard.aspx");
                }
            }
            else
            {
                lblErrorMessage.Text = "Eithe Username or password is Invalid, Try again...!";
            }
        }
        else
        {
            Response.Redirect("~/AdminPanel/Authentication/CheckUser.aspx");
        }
    }
Exemplo n.º 25
0
 public AdminController()
 {
     adminBal = new AdminBAL();
 }
 public string InsertDriver(string id, string name, string lastName, string password, string longitude, string latitude)
 {
     return(AdminBAL.InsertDriver(id, name, lastName, password, longitude, latitude));
 }
Exemplo n.º 27
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (uploadNotes.HasFile)
                {
                    string strExtension = System.IO.Path.GetExtension(uploadNotes.FileName);
                    if (strExtension == ".docx" || strExtension == ".doc" || strExtension == ".pdf" || strExtension == ".xlsx" || strExtension == ".xlsm")
                    {
                        AdminBAL _resourcesBAL = new AdminBAL();

                        string strname  = uploadNotes.FileName.ToString();
                        string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
                        uploadNotes.SaveAs(Server.MapPath("~/Images/Uploaded Documents") + fileName + strname);
                        string filename = System.IO.Path.GetFileName(uploadNotes.FileName);
                        if (DateTime.Parse(txtBoxFrom.Text) >= DateTime.Now && DateTime.Parse(txtBoxTo.Text) >= DateTime.Now)
                        {
                            if (DateTime.Parse(txtBoxFrom.Text) <= DateTime.Parse(txtBoxTo.Text))
                            {
                                ScheduleBO schedule = new ScheduleBO
                                {
                                    StartFrom = DateTime.Parse(txtBoxFrom.Text),
                                    EndOn     = DateTime.Parse(txtBoxTo.Text),
                                    BatchId   = txtBoxId.Text,
                                    Subject   = txtBoxSubject.Text,
                                    TimeSlot  = dropDownTime.SelectedValue
                                };
                                DocumentBO notes = new DocumentBO
                                {
                                    Subject     = txtBoxSubject.Text,
                                    UploadedBy  = Session["UserId"].ToString(),
                                    UploadedOn  = DateTime.Now,
                                    File        = "~/Images/Uploaded Documents" + fileName + strname,
                                    Description = txtBoxDesc.Text
                                };
                                UserBAL scheduleList = new UserBAL();
                                int     result       = scheduleList.AddScheduleBAL(notes, schedule);
                                if (result >= 1)
                                {
                                    lblStatus.Text       = "Schedule Added Successfully!! Pls Refresh the Page";
                                    hiddenSchedule.Value = "";
                                }
                                else
                                {
                                    lblStatus.Text = "BatchID already exists!!";
                                }
                            }
                            else
                            {
                                lblStatus.Text = "End date should be after start date !!";
                            }
                        }
                        else
                        {
                            lblStatus.Text = "Schedule for Past Dates are not allowed";
                        }
                    }
                }
                else
                {
                    lblStatus.Text = "Please Upload Notes";
                }
            }
            catch (Exception ex)
            {
                lblStatus.Text = ex.Message;
            }
        }
 public string DriversList()
 {
     return(AdminBAL.DriversList());
 }
 public string Login(string id, string password)
 {
     return(AdminBAL.Login(id, password));
 }
 public string TrashCansList()
 {
     return(AdminBAL.TrashCansList());
 }