Пример #1
0
        public DataSet dal_Logindetail(bel_login obj_bel_Login)
        {
            DataSet ds = new DataSet();
               try
               {
               SqlCommand sqlcmd = new SqlCommand("spu_Login");
               sqlcmd.CommandTimeout = 0;
               sqlcmd.CommandType = CommandType.StoredProcedure;
               sqlcmd.Parameters.Clear();
               sqlcmd.Parameters.AddWithValue("@iMode", obj_bel_Login._iMode);
               sqlcmd.Parameters.AddWithValue("@LoginID", obj_bel_Login._LoginID);
               sqlcmd.Parameters.AddWithValue("@LoginPassword", obj_bel_Login._LoginPassword);
               sqlcmd.Parameters.AddWithValue("@UserID", obj_bel_Login._UserID);
               sqlcmd.Parameters.AddWithValue("@UserGroupID", obj_bel_Login._UserGroupID);
               //sqlcmd.Parameters.AddWithValue("@YearName", obj_bel_Login._YearName);
              // sqlcmd.Parameters.AddWithValue("@YearStatus", obj_bel_Login._YearStatus);
               sqlcmd.Parameters.AddWithValue("@BranchID", obj_bel_Login._BranchID);
               sqlcmd.Parameters.AddWithValue("@CompanyID", obj_bel_Login._CompanyID);
               sqlcmd.Parameters.AddWithValue("@PassordCompanyID", obj_bel_Login._PassordCompanyID);
               sqlcmd.Parameters.AddWithValue("@EmailID", obj_bel_Login._EmailID);
               sqlcmd.Parameters.AddWithValue("@BillFromDate", obj_bel_Login._BillFromDate);
               sqlcmd.Parameters.AddWithValue("@BillToDate", obj_bel_Login._BillToDate);

               ds = DataFunctions.GetDataSet(sqlcmd);
               }
               catch (Exception ex)
               {

               }
               return ds;
        }
Пример #2
0
        public string Authenticate(string LoginID, string LoginPassword, int BranchID, int CompanyID,string BranchName ,string CompanyName,bool rememberMe)
        {
            DataSet ds = new DataSet();
            EnCryptionAndDecription Obj_ComEncript = new EnCryptionAndDecription();
            bel_login bel = new bel_login();
            dal_login dal = new dal_login();
            bel._LoginID = LoginID;
            bel._LoginPassword = Obj_ComEncript.fEncrypt(LoginPassword);
            bel._iMode = "login";
            bel._BranchID = BranchID;
            bel._CompanyID = CompanyID;
            ds = dal.dal_Logindetail(bel);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows[0][0].ToString() != "ERROR_USERNAME")
                {
                    // string n = ds.Tables[1].Rows[0]["LoginID"].ToString();
                    HttpContext.Current.Session["UserName"] = ds.Tables[1].Rows[0]["LoginID"].ToString();
                    HttpContext.Current.Session["UserID"] = ds.Tables[1].Rows[0]["UserID"].ToString();
                    HttpContext.Current.Session["UserGroupID"] = ds.Tables[1].Rows[0]["UserGroupID"].ToString();
                    HttpContext.Current.Session["IsSuperAdmin"] = ds.Tables[1].Rows[0]["IsSuperAdmin"].ToString();
                    HttpContext.Current.Session["CompanyName"] = Convert.ToString(CompanyName);
                    HttpContext.Current.Session["Year"] = ds.Tables[2].Rows[0]["Year"].ToString();
                    HttpContext.Current.Session["CompanyID"] = CompanyID;
                    HttpContext.Current.Session["BranchName"] = Convert.ToString(BranchName);
                    HttpContext.Current.Session["BranchID"] = BranchID;
                    //context.Response.Write(Json.GetJson(ds.Tables[0]));
                    if (rememberMe)
                    {
                        HttpContext.Current.Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(30);
                        HttpContext.Current.Response.Cookies["Password"].Expires = DateTime.Now.AddDays(30);
                    }
                    else
                    {
                        HttpContext.Current.Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(-1);
                        HttpContext.Current.Response.Cookies["Password"].Expires = DateTime.Now.AddDays(-1);
                    }
                    HttpContext.Current.Response.Cookies["UserName"].Value = LoginID.Trim();
                    HttpContext.Current.Response.Cookies["Password"].Value = LoginPassword.Trim();

                    return "SUCCESS";
                }
                else
                {
                    return "FAIL";
                }
            }
            else
            {
                return "FAIL";
            }
        }
Пример #3
0
 private void BindCompanyDropDownList()
 {
     //IEnumerable<DbGetOfficesResult> offices = Offices.GetOffices();
     bel_login bel = new bel_login();
     dal_login dal = new dal_login();
     bel._iMode = "ComboBind";
     DataSet ds1 = dal.dal_Logindetail(bel);
     this.CompanySelect.DataSource = ds1.Tables[0];
     this.CompanySelect.DataBind();
 }