Ejemplo n.º 1
0
    protected void btn_search_Click(object sender, EventArgs e)
    {
        string temp = "where  =" + txt_Date.Text + "and location" + ddl_location.SelectedValue;

        Session["locationstring"] = Convert.ToString(ddl_location.SelectedItem);
        if (ddl_location.SelectedIndex == 0)
        {
            lbl_msg.InnerText = "Please Select location and Date";
        }
        else
        {
            Session["date"]     = txt_Date.Text;
            Session["location"] = ddl_location.SelectedValue;
            LoadPatientIE(txt_Date.Text, Convert.ToInt16(ddl_location.SelectedValue));
            string LogName = Session["uname"].ToString();
            string LogLocation;
            if (string.IsNullOrWhiteSpace(Convert.ToString(Session["locationstring"])))
            {
                LogLocation = "";
            }
            else
            {
                LogLocation = Session["locationstring"].ToString();
            }
            string LogIp          = "";
            string LogDescription = "";
            string LogIntime      = null;
            string LogOutTime     = Convert.ToString(System.DateTime.Now);
            string log_id         = Session["log"].ToString();
            db.logDetailtbl(Convert.ToInt32(Session["log"].ToString()), "signIn Sheet", Convert.ToString(System.DateTime.Now));
            db.logDetail(LogName, LogLocation, LogIp, LogDescription, LogIntime, LogOutTime, log_id);
        }
    }
Ejemplo n.º 2
0
    public void bindData()
    {
        DataSet ds = db.logDetail(txt_start_date.Text, txt_end_date.Text, Convert.ToString(ddl_Login_Id.SelectedItem), Convert.ToString(ddl_location.SelectedItem));

        if (ds.Tables[0].Rows.Count > 0)
        {
            gdview.DataSource = ds;
            gdview.DataBind();
            btnExportExcel.Visible = true;
            btnExportPDF.Visible   = true;
            txtSearch.Visible      = true;
        }
    }
Ejemplo n.º 3
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (chkRememberMe.Checked)
        {
            Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(30);
            Response.Cookies["Password"].Expires = DateTime.Now.AddDays(30);
        }
        else
        {
            Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(-1);
            Response.Cookies["Password"].Expires = DateTime.Now.AddDays(-1);
        }

        //string query = "select Password from tblUserMaster where (LoginID=@uname or eMailID=@uname)";
        string query = " select LoginID,Password,Designation,desig_id,groupid from tblUserMaster where (LoginID=@uname or eMailID=@uname) and UserMasterId='" + txtUserMasterID.Text + "'";
        //SqlConnection cn = new SqlConnection("server=OWNER-PC\\SQLEXPRESS;uid=sa;pwd=Annie123;Initial Catalog=dbPainTraxX3");
        SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["connString_V3"].ConnectionString);

        SqlCommand cm = new SqlCommand(query, cn);

        cm.Parameters.AddWithValue("@uname", txt_uname.Text);


        SqlDataAdapter da = new SqlDataAdapter(cm);
        DataSet        ds = new DataSet();

        da.Fill(ds);

        if (ds.Tables[0].Rows.Count > 0)
        {
            if (ds.Tables[0].Rows[0]["Password"].ToString() == txt_pass.Text)
            {
                try
                {
                    Session["uname"] = txt_uname.Text;
                    DBHelperClass db      = new DBHelperClass();
                    string        LogName = Session["uname"].ToString();
                    string        _result = new BusinessLogic().login(txt_uname.Text.Trim(), txt_pass.Text.Trim());
                    if (_result != null)
                    {
                        Session["UserId"]          = _result;
                        Session["UserDesignation"] = ds.Tables[0].Rows[0]["Designation"].ToString();
                        Session["UserDesigId"]     = ds.Tables[0].Rows[0]["desig_id"].ToString();


                        DataSet dbGroup = db.selectData("Select * from tblgroups where id=" + ds.Tables[0].Rows[0]["groupid"].ToString());

                        if (dbGroup != null && dbGroup.Tables[0].Rows.Count > 0)
                        {
                            Session["Locations"]    = dbGroup.Tables[0].Rows[0]["locations_id"].ToString();
                            Session["pageAccess"]   = dbGroup.Tables[0].Rows[0]["page_id"].ToString();
                            Session["roles"]        = dbGroup.Tables[0].Rows[0]["role_id"].ToString();
                            Session["reportAccess"] = dbGroup.Tables[0].Rows[0]["reports"].ToString();
                        }
                        else
                        {
                            Session["Locations"]    = "";
                            Session["pageAccess"]   = "";
                            Session["roles"]        = "";
                            Session["reportAccess"] = "";
                        }
                    }

                    string LogLocation    = "";
                    string LogIp          = Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request.ServerVariables["REMOTE_ADDR"];
                    string LogDescription = "LoginPage Entry";
                    string LogIntime      = Convert.ToString(System.DateTime.Now);
                    string LogOutTime     = null;
                    string log_id         = null;
                    db.logDetail(LogName, LogLocation, LogIp, LogDescription, LogIntime, LogOutTime, log_id);
                    Session["log"] = Convert.ToInt32(HttpContext.Current.Session["log_id"].ToString());
                    db.logDetailtbl(Convert.ToInt32(Session["log"].ToString()), "LogIn", Convert.ToString(System.DateTime.Now));
                    Response.Cookies["UserName"].Value = txt_uname.Text.Trim();
                    Response.Cookies["Password"].Value = txt_pass.Text.Trim();
                    Logger.Info(Session["UserId"].ToString() + '-' + Session["uname"].ToString().Trim() + "- Logged in at -" + DateTime.Now + " with Ip address -" + LogIp);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
                Response.Redirect("GetMAProviders.aspx");
            }
            else
            {
                lblmess.Attributes.Add("style", "display:block");
            }
        }
        else
        {
            lblmess.Attributes.Add("style", "display:block");
            Logger.Info("Login Failed" + '-' + txt_uname.Text.Trim());
        }
    }