Ejemplo n.º 1
0
        public DataTable GetLCODetails(string username)
        {
            Cls_Data_Auth objAuth    = new Cls_Data_Auth();
            Hashtable     htResponse = new Hashtable();

            return(objAuth.GetLCODetails(username));
        }
Ejemplo n.º 2
0
        protected void ibtLogIn_Click(object sender, ImageClickEventArgs e)
        {
            //if (Session["captcha"].ToString() == txtcaptcha.Text.Trim())
            //{

            //}
            //else
            //{
            //    Response.Write("<script>alert('Please provide Proper Captcha');</script>");
            //    return;
            //}
            string blusername = SecurityValidation.chkData("T", txtUsername.Text + "" + txtPassword.Text);

            if (blusername.Length > 0)
            {
                Response.Write("<script>alert('Incorrect values entered');</script>");
                return;
            }
            Cls_Data_Auth auth        = new Cls_Data_Auth();
            string        Ip          = auth.GetIPAddress(HttpContext.Current.Request);
            Hashtable     credentials = new Hashtable();

            credentials["username"] = txtUsername.Text;
            credentials["password"] = txtPassword.Text;
            credentials["IP"]       = Ip;

            Cls_Business_Auth objAuth      = new Cls_Business_Auth();
            Hashtable         authResponse = objAuth.GetAuthResponse(credentials);

            if (authResponse["ex_ocuured"] == null)
            {
                int    responseFlag = Convert.ToInt32(authResponse["response_code"]);
                string responseMsg  = authResponse["response_msg"].ToString();
                if (responseFlag == 9999)
                {
                    Session["user_id"]      = authResponse["user_id"];
                    Session["user_brmpoid"] = authResponse["user_brmpoid"];
                    Session["username"]     = txtUsername.Text;
                    Session["operator_id"]  = authResponse["operator_id"];
                    Session["category"]     = authResponse["user_operator_category"];
                    Session["name"]         = authResponse["user_name"];
                    Session["last_login"]   = authResponse["last_login"];
                    Session["login_flag"]   = authResponse["login_flag"];
                    Session["showimage"]    = "Y";
                    Session["MIAflag"]      = authResponse["MIAflag"];
                    string oddeven = "";
                    try
                    {
                        oddeven = CreateAlphaNeumericTransferCode();
                        Session["RPAuthToken"] = Convert.ToString(oddeven);
                        // now create a new cookie with this guid value
                        Response.Cookies.Add(new HttpCookie("AuthToken", Convert.ToString(oddeven)));
                    }
                    catch { }

                    //var url = "http://localhost:16218/Transaction/Home.aspx";


                    try
                    {
                        Hashtable sessionlog = new Hashtable();
                        sessionlog["username"]  = Session["username"];
                        sessionlog["sessionid"] = Session.SessionID;
                        sessionlog["pagename"]  = "Login.aspx";
                        sessionlog["name"]      = Session["name"];
                        sessionlog["IP"]        = Ip;

                        string resssion = objAuth.SessionLog(sessionlog);
                    }
                    catch { }


                    String GSTNO = "";
                    objAuth.GetGSTNo(Session["operator_id"].ToString(), out GSTNO);

                    if (GSTNO != "")
                    {
                        lblLoginResult.Text = "User login successful";
                        //if (authResponse["user_operator_category"].ToString() == "3")
                        //{
                        //    //if Logged in user is LCO
                        //    Response.Redirect("~/Reports/rptLCOAllDetails.aspx");
                        //}
                        //else
                        //{
                        if (authResponse["user_operator_category"].ToString() == "3" || authResponse["user_operator_category"].ToString() == "11")
                        {
                            NameValueCollection collections = new NameValueCollection();
                            collections.Add("username", txtUsername.Text.Trim());
                            collections.Add("Name", authResponse["user_name"].ToString());
                            //string remoteUrl = "https://hathwayconnectuat.com/Transaction/Home.aspx"; //-- UAT
                            //string remoteUrl = "http://localhost:2388/Transaction/Home.aspx";//--- LOCAL
                            string remoteUrl = "http://local.hathway.com/Transaction/Home.aspx";//--- LOCAL
                            string html      = "<html><head>";
                            html += "</head><body onload='document.forms[0].submit()'>";
                            html += string.Format("<form name='PostForm' method='POST' action='{0}'>", remoteUrl);
                            foreach (string key in collections.Keys)
                            {
                                html += string.Format("<input name='{0}' type='hidden' value='{1}'>", key, collections[key]);
                            }
                            html += "</form></body></html>";
                            Response.Clear();
                            Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1");
                            Response.HeaderEncoding  = Encoding.GetEncoding("ISO-8859-1");
                            Response.Charset         = "ISO-8859-1";
                            Response.Write(html);
                            Response.End();
                            Response.Redirect("~/Transaction/Home.aspx", true);//for lco
                        }
                        else
                        {
                            string script = "<script language=\"javascript\" type=\"text/javascript\">alert('You Are Not Authorised to Login in this Portal.');</script>";
                            Response.Write(script);
                        }
                    }
                    else
                    {
                        String AccepLCOCOde = "";
                        objAuth.GetAccepGST(txtUsername.Text, out AccepLCOCOde);
                        if (AccepLCOCOde == "")
                        {
                            DateTime      DT         = DateTime.Today;
                            string        CURDATE    = DT.ToString("dd-MMM-yyyy");
                            Cls_Data_Auth objTran    = new Cls_Data_Auth();
                            DataTable     htResponse = objTran.GetLCODetails(txtUsername.Text);

                            if (htResponse.Rows.Count > 0)
                            {
                                if (htResponse.Rows[0]["var_compconfig_localaddress"].ToString() != "")
                                {
                                    userGST._lblCompanyAddress = htResponse.Rows[0]["var_compconfig_localaddress"].ToString();
                                }
                                if (htResponse.Rows[0]["var_lcomst_company"].ToString() != "")
                                {
                                    userGST._lblCompanyName = htResponse.Rows[0]["var_lcomst_company"].ToString();
                                }
                                if (htResponse.Rows[0]["var_lcomst_code"].ToString() != "")
                                {
                                    userGST._lblLCOCode = htResponse.Rows[0]["var_lcomst_code"].ToString();
                                }
                                if (htResponse.Rows[0]["var_lcomst_name"].ToString() != "")
                                {
                                    userGST._lblLCOName = htResponse.Rows[0]["var_lcomst_name"].ToString();
                                }
                                if (htResponse.Rows[0]["var_lcomst_name"].ToString() != "")
                                {
                                    userGST._lblLCONameHead = htResponse.Rows[0]["var_lcomst_name"].ToString();
                                }

                                userGST._lblSYSDATE     = CURDATE;
                                userGST._lblSYSDATETIME = DT.ToString();
                            }
                            popMsg.Show();
                            //else
                            //{
                            //}
                        }
                        else
                        {
                            if (authResponse["user_operator_category"].ToString() == "3" || authResponse["user_operator_category"].ToString() == "11")
                            {
                                NameValueCollection collections = new NameValueCollection();
                                collections.Add("username", txtUsername.Text.Trim());
                                collections.Add("Name", authResponse["user_name"].ToString());
                                string remoteUrl = "http://local.hathway.com/Transaction/Home.aspx";//--- LOCAL
                                //string remoteUrl = "http://localhost:2388/Transaction/Home.aspx"; //-- LOCAL
                                //string remoteUrl = "https://hathwayconnectuat.com/Transaction/Home.aspx";// UAT
                                string html = "<html><head>";
                                html += "</head><body onload='document.forms[0].submit()'>";
                                html += string.Format("<form name='PostForm' method='POST' action='{0}'>", remoteUrl);
                                foreach (string key in collections.Keys)
                                {
                                    html += string.Format("<input name='{0}' type='hidden' value='{1}'>", key, collections[key]);
                                }
                                html += "</form></body></html>";
                                Response.Clear();
                                Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1");
                                Response.HeaderEncoding  = Encoding.GetEncoding("ISO-8859-1");
                                Response.Charset         = "ISO-8859-1";
                                Response.Write(html);
                                Response.End();
                                Response.Redirect("Transaction/frmAssignPlan.aspx");//"~/Transaction/Home.aspx", true);//for lco
                            }
                            else
                            {
                                string script = "<script language=\"javascript\" type=\"text/javascript\">alert('You Are Not Authorised to Login in this Portal.');</script>";
                                Response.Write(script);
                            }
                        }
                    }
                }
                else
                {
                    txtUsername.Text = "";
                    txtPassword.Text = "";
                    txtUsername.Focus();
                    string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + responseMsg + "');</script>";
                    Response.Write(script);
                }
            }
            else
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }