public static void InitAccessLevel(int id, FormView FormView1, String dlID)
    {
        try
        {
            using (WoWiModel.WoWiEntities db = new WoWiModel.WoWiEntities())
            {
                try
                {
                    var typeList = from c in db.m_employee_accesslevel where c.employee_id== id select c;
                    foreach (WoWiModel.m_employee_accesslevel item in typeList)
                    {
                        try
                        {
                            SetTypes(item.accesslevel_id, FormView1, dlID);
                        }
                        catch (Exception)
                        {

                            //throw;
                        }

                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        catch
        {
        }
    }
 protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
 {
     using (SqlConnection cn =
         new SqlConnection(ConfigurationManager.ConnectionStrings["WoWiConnectionString"].ConnectionString))
     {
         cn.Open();
         SqlCommand cmd =
             new SqlCommand("Select username from employee Where username=@username and password=@password and status='Active'", cn);
         cmd.Parameters.AddWithValue("@username", LoginUser.UserName);
         cmd.Parameters.AddWithValue("@password", LoginUser.Password);
         SqlDataReader dr = cmd.ExecuteReader();
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 string username = dr["username"].ToString();
                 using (WoWiModel.WoWiEntities wowidb = new WoWiModel.WoWiEntities())
                 {
                     int id = (from emp in wowidb.employees where emp.username == username select emp.id).First();
                     Session["Session_User_Id"] = id;
                 }
                 FormsAuthentication.RedirectFromLoginPage(username , LoginUser.RememberMeSet);
             }
         }
     }
 }
 public static void InitRoles(int id, FormView FormView1,String dlID)
 {
     try
     {
         using (WoWiModel.WoWiEntities db = new WoWiModel.WoWiEntities())
         {
             try
             {
                 var roleList = from c in db.m_contact_role where c.contact_id == id select c;
                 foreach (WoWiModel.m_contact_role item in roleList)
                 {
                     Utils.SetCheckBoxListValues(item.role_id, FormView1, dlID);
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }
     catch
     {
     }
 }
 public static void InitTechnologyData(int id, FormView FormView1, String dlID)
 {
     try
     {
         using (WoWiModel.WoWiEntities db = new WoWiModel.WoWiEntities())
         {
             try
             {
                 var typeList = from c in db.m_clientappliant_technology where c.clientappliant_id == id select c;
                 foreach (WoWiModel.m_clientappliant_technology item in typeList)
                 {
                     SetTypes(item.technology_id, FormView1, dlID);
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }
     catch
     {
     }
 }
Beispiel #5
0
    public static bool isSysAdmin(int id)
    {
        bool ret = false;
          try
          {
          using (WoWiModel.WoWiEntities wowidb = new WoWiModel.WoWiEntities())
          {
              var data = wowidb.employees.First(c => c.id == id && c.department_id == 1);
              ret = true;
          }
          }
          catch (Exception ex)
          {

          //throw;
          }

          return ret;
    }
Beispiel #6
0
    public static bool isAdmin(int id)
    {
        bool ret = false;
        try
        {
          using (WoWiModel.WoWiEntities wowidb = new WoWiModel.WoWiEntities())
          {
        var data = wowidb.m_employee_accesslevel.First(c => c.employee_id == id && c.accesslevel_id == 1);
        ret = true;
          }
        }
        catch (Exception ex)
        {

          //throw;
        }

        return ret;
    }
Beispiel #7
0
    public static int GetEmployeeID(String username)
    {
        int id = -1;
        try
        {
          using (WoWiModel.WoWiEntities wowidb = new WoWiModel.WoWiEntities())
          {
        id = (from emp in wowidb.employees where emp.username == username select emp.id).First();
          }
        }
        catch (Exception ex)
        {

          //throw;
        }

        return id;
    }