コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (InhToDoListDataContext dbc = new InhToDoListDataContext())
     {
         var objcurrentuser = (from t1 in dbc.mst_user_logins
                               where t1.mul_user_login == Constant.CurrentUserLogin
                               select t1).FirstOrDefault();
         if (objcurrentuser != null)
         {
             //Convert1.ToString(objcurrentuser.mul_lname)
             lbllogin_detail.Text = String.Format(Convert1.ToString(objcurrentuser.mul_fname) +
                                                  " " + Constant.CurrentUserLoginName +
                                                  " : เข้าสู่ระบบเมื่อ {0:dd/MM/yyyy HH:mm}", DateTime.Now);
         }
     }
 }
コード例 #2
0
 public static DateTime ConvertStringToDate(String strdate)
 {
     try
     {
         string[] datespilt = strdate.Trim().Split('/');
         int      d         = Convert1.ToInt32(datespilt[0]);
         int      m         = Convert1.ToInt32(datespilt[1]);
         int      y         = Convert1.ToInt32(datespilt[2]);
         DateTime dnow      = new DateTime(y, m, d);
         return(dnow);
     }
     catch (Exception)
     {
         return(DateTime.Now);
     }
 }
コード例 #3
0
        public static string MargeString(object str1, object str2, string strsplit)
        {
            string nameTH  = Convert1.ToString(str1);
            string nameEN  = Convert1.ToString(str2);
            string NameAll = "";

            if (nameTH == "" || nameEN == "")
            {
                if (nameTH != "")
                {
                    NameAll = nameTH;
                }
                if (nameEN != "")
                {
                    NameAll = nameEN;
                }
            }
            else
            {
                NameAll = nameTH + strsplit + nameEN;
            }
            return(NameAll);
        }
コード例 #4
0
        protected void btnsubmit_Click(object sender, ImageClickEventArgs e)
        {
            if (txtUser.Text == "" || txtpass.Text == "")
            {
                lbalertmsg.Text = "input UserName & Password try again";
                txtUser.Focus();
                return;
            }
            string msgalert = "";

            if (Login1(txtUser.Text.Trim(), txtpass.Text.Trim(), ref msgalert))
            {
                //Constant.CurrentUserLogin = "******";
                string backurl = Convert1.ToString(Request.QueryString["backurl"]).ToLower();
                if (backurl == "refresh")
                {
                    litscript.Text = "<script type='text/javascript'>reloadparent();</script>";
                }
                else if (backurl != "")
                {
                    String goUrl = Context.Server.UrlDecode(backurl);
                    Context.Response.Redirect(backurl);
                }
                else
                {
                    //Defualt Page Current
                    using (InhToDoListDataContext dbc = new InhToDoListDataContext())
                    {
                        var objpolicy = (from t1 in dbc.mst_user_logins
                                         where t1.mul_user_login == Constant.CurrentUserLogin
                                         select t1.mst_user_type.mut_code).FirstOrDefault();
                        if (objpolicy != null)
                        {
                            Constant.CurrentPageLogin = objpolicy;
                        }
                    }

                    switch (Constant.CurrentPageLogin)
                    {
                    case "MKT":
                        Response.Redirect(this.Page.ResolveClientUrl("~/frmmktNew.aspx"));
                        break;

                    case "HPC":
                        Response.Redirect(this.Page.ResolveClientUrl("~/frm_hpc.aspx"));
                        break;

                    case "CLT":
                        Response.Redirect(this.Page.ResolveClientUrl("~/frm_collection.aspx"));
                        break;

                    case "CTC":
                        Response.Redirect(this.Page.ResolveClientUrl("~/frm_contact_center.aspx"));
                        break;
                        //case "All":
                        //    Response.Redirect(this.Page.ResolveClientUrl("~/frmHome.aspx"));
                        //    break;
                    }
                    //Response.Redirect(this.Page.ResolveClientUrl("~/frmHome.aspx"));
                }
            }
            else
            {
                if (msgalert != "")
                {//กรณีที่ไม่ได้ Active User
                    lbalertmsg.Text = msgalert;
                }
                else
                {
                    lbalertmsg.Text = "UserName & Password incorrect. Please try again";
                }
                txtUser.Text = "";
                txtpass.Text = "";
                txtUser.Focus();
            }
        }