コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserCreationService.iUserCreationClient UserCreationClient = new UserCreationService.iUserCreationClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                if (Session.Timeout > 0)
                {
                    userName.Text       = profile.Personal.UserName;
                    ClientLogo.ImageUrl = profile.Personal.CLogoURL;
                    //btnLogout.HRef = "../Login/Login.aspx?ID=" + profile.Personal.CompanyID.ToString();

                    //BindMenuService.iBindMenuClient objBindMenuClient = new BindMenuService.iBindMenuClient();
                    //BindMenuService.ProBindMenu objProBindMenu = new BindMenuService.ProBindMenu();
                    //List<BindMenuService.ProBindMenu> ListobjProBindMenu = new List<BindMenuService.ProBindMenu>();
                    //objProBindMenu._constP = profile.DBConnection._constr;
                    //objProBindMenu.CompanyCode = profile.Personal.CompanyID;
                    //objProBindMenu.UserCode = profile.Personal.UserID;
                    //ListobjProBindMenu = objBindMenuClient.BindUserMenu(objProBindMenu).ToList();

                    if (Session["htmlMenu"] == null)
                    {
                        Session["htmlMenu"] = UserCreationClient.GetHTMLMenuByUserID(profile.Personal.UserID, profile.DBConnection._constr);
                    }

                    dvMenu.InnerHtml = Session["htmlMenu"].ToString();
                    if (profile.Personal.ProfileImg != null)
                    {
                        Session["ProfileImgMasterPg"] = profile.Personal.ProfileImg;
                        ImgProfileMasterPg.Src        = "../Image1.aspx";
                    }
                    else
                    {
                        ImgProfileMasterPg.Src = "../App_Themes/Blue/img/Male.png";
                        if (profile.Personal.Gender != null)
                        {
                            if (profile.Personal.Gender != "M")
                            {
                                ImgProfileMasterPg.Src = "../App_Themes/Blue/img/Female.png";
                            }
                        }
                    }
                }
                else
                {
                    LoginService.iLoginClient loginclient = new LoginService.iLoginClient();
                    loginclient.ClearTempDataBySessionID(Session.SessionID, profile.Personal.UserID.ToString(), profile.DBConnection._constr);
                    Session.Clear();
                    Session.Abandon();
                    Response.Redirect("../Login/Login.aspx?TimeOut=true&ID=" + profile.Personal.CompanyID.ToString(), false);
                }
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, "Master Page", "Bind Menu");
            }
            finally { UserCreationClient.Close(); }
        }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            SqlConnection conn = new SqlConnection(strcon);

            String userId   = context.Request.Form["usrId"];
            String userPass = context.Request.Form["usrPass"];


            CustomProfile profile = CustomProfile.GetProfile(userId);

            String xmlString = String.Empty;

            context.Response.ContentType = "text/xml";
            xmlString = xmlString + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            xmlString = xmlString + "<gwcInfo>";


            xmlString = xmlString + "<profileInfo>";
            if (Membership.ValidateUser(userId, userPass))
            {
                UserCreationService.iUserCreationClient UserCreationClient = new UserCreationService.iUserCreationClient();
                long useridd = Convert.ToInt64(profile.Personal.UserID.ToString());


                SqlCommand     cmd3 = new SqlCommand();
                SqlDataAdapter da3  = new SqlDataAdapter();
                DataSet        ds3  = new DataSet();
                DataTable      dt3  = new DataTable();
                cmd3.CommandType = CommandType.Text;
                cmd3.CommandText = "select MobileInterface from mUserProfileHead where id=" + useridd + "";
                cmd3.Connection  = conn;
                cmd3.Parameters.Clear();
                da3.SelectCommand = cmd3;
                da3.Fill(ds3, "tbl4");
                dt3 = ds3.Tables[0];

                int mobileinterface = Convert.ToInt32(dt3.Rows[0]["MobileInterface"].ToString());
                if (mobileinterface == 1)
                {
                    string usrName = profile.Personal.UserName.ToString();
                    string cmpny   = profile.Personal.CompanyID.ToString();
                    string cmpnyNm = profile.Personal.CName.ToString();
                    string deptID  = profile.Personal.DepartmentID.ToString();


                    SqlCommand     cmd1 = new SqlCommand();
                    SqlDataAdapter da1  = new SqlDataAdapter();
                    DataSet        ds1  = new DataSet();
                    DataTable      dt1  = new DataTable();

                    cmd1.CommandType = CommandType.Text;
                    cmd1.CommandText = "select Territory from mTerritory where id=" + deptID + "";
                    cmd1.Connection  = conn;
                    cmd1.Parameters.Clear();
                    da1.SelectCommand = cmd1;
                    da1.Fill(ds1, "tbl1");
                    dt1 = ds1.Tables[0];
                    string deptNm = ds1.Tables[0].Rows[0]["Territory"].ToString();

                    // string deptNm = profile.Personal.Department.ToString();
                    string deptNam = CheckString(deptNm);
                    string mobNo   = profile.Personal.MobileNo;
                    string dbid    = profile.Personal.UserID.ToString();
                    string type    = profile.Personal.UserType.ToString();

                    string type1 = "";
                    if (type == "Requestor")
                    {
                        type1 = "Requester";
                    }
                    else if (type == "Requestor And Approver")
                    {
                        type1 = "Requester And Approver";
                    }
                    else if (type == "Admin")
                    {
                        type1 = "Requester And Approver";
                    }
                    else if (type == "Super Admin")
                    {
                        type1 = "Requester And Approver";
                    }
                    else
                    {
                        type1 = type;
                    }

                    string deptlist = GetDeptList(dbid);

                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = " select Name from mCompany where ID=" + cmpny + "";
                    cmd.Connection  = conn;
                    cmd.Parameters.Clear();
                    da.SelectCommand = cmd;
                    da.Fill(ds, "tbl1");
                    dt = ds.Tables[0];

                    string CompanyName = ds.Tables[0].Rows[0]["Name"].ToString();

                    xmlString = xmlString + "<username>" + CheckString(usrName) + "</username>";
                    xmlString = xmlString + "<companyid>" + cmpny + "</companyid>";
                    xmlString = xmlString + "<companyname>" + CheckString(CompanyName) + "</companyname>";
                    xmlString = xmlString + "<departmentid>" + deptID + "</departmentid>";
                    xmlString = xmlString + "<departmentname>" + CheckString(deptNam) + "</departmentname>";
                    xmlString = xmlString + "<departmentlist>" + CheckString(deptlist) + "</departmentlist>";

                    xmlString = xmlString + "<userid>" + userId + "</userid>";
                    xmlString = xmlString + "<dbid>" + dbid + "</dbid>";
                    xmlString = xmlString + "<mobile>" + mobNo + "</mobile>";
                    xmlString = xmlString + "<type>" + type1 + "</type>";
                    xmlString = xmlString + "<authmsg>success</authmsg>";
                }
                else
                {
                    xmlString = xmlString + "<authmsg>You don't have access for Mobile Application</authmsg>";
                }
            }
            else
            {
                xmlString = xmlString + "<authmsg>failed</authmsg>";
            }


            xmlString = xmlString + "</profileInfo>";

            xmlString = xmlString + "</gwcInfo>";

            context.Response.Write(xmlString);
        }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            SqlConnection conn     = new SqlConnection(strcon);
            string        userId   = context.Request.Form["usrId"];
            string        userPass = context.Request.Form["usrPass"];

            CustomProfile profile = CustomProfile.GetProfile(userId);

            String xmlString = String.Empty;

            context.Response.ContentType = "text/xml";
            xmlString = xmlString + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            xmlString = xmlString + "<gwcInfo>";


            xmlString = xmlString + "<profileInfo>";

            if (Membership.ValidateUser(userId, userPass))
            {
                UserCreationService.iUserCreationClient UserCreationclient = new UserCreationService.iUserCreationClient();
                long useridd = Convert.ToInt64(profile.Personal.UserID.ToString());


                SqlCommand     cmd3 = new SqlCommand();
                SqlDataAdapter da3  = new SqlDataAdapter();
                DataSet        ds3  = new DataSet();
                DataTable      dt3  = new DataTable();
                cmd3.CommandType = CommandType.Text;
                cmd3.CommandText = "select MobileInterface from mUserProfileHead where id=" + useridd + "";
                cmd3.Connection  = conn;
                cmd3.Parameters.Clear();
                da3.SelectCommand = cmd3;
                da3.Fill(ds3, "tbl4");
                dt3 = ds3.Tables[0];

                int mobileinterface = Convert.ToInt32(dt3.Rows[0]["MobileInterface"].ToString());
                if (mobileinterface == 1)
                {
                    string usrName = profile.Personal.UserName.ToString();

                    string mobNo = profile.Personal.MobileNo;
                    string dbid  = profile.Personal.UserID.ToString();
                    string type  = profile.Personal.UserType.ToString();

                    string type1 = "";
                    if (type == "Driver")
                    {
                        type1 = "Driver";
                    }
                    else
                    {
                        type1 = type;
                    }

                    xmlString = xmlString + "<username>" + usrName + "</username>";
                    xmlString = xmlString + "<userid>" + userId + "</userid>";
                    xmlString = xmlString + "<dbid>" + dbid + "</dbid>";
                    xmlString = xmlString + "<mobile>" + mobNo + "</mobile>";
                    xmlString = xmlString + "<type>" + type1 + "</type>";
                    xmlString = xmlString + "<authmsg>success</authmsg>";
                }
                else
                {
                    xmlString = xmlString + "<authmsg>You don't have access for Mobile Application</authmsg>";
                }
            }
            else
            {
                xmlString = xmlString + "<authmsg>failed</authmsg>";
            }


            xmlString = xmlString + "</profileInfo>";

            xmlString = xmlString + "</gwcInfo>";

            context.Response.Write(xmlString);
        }