public string updateUseraccount(string hrcode, string Password)
        {
            try
            {
                //Global obj = new Global();
                //string SQL = "update HrMaster set Password ='******' where hrcode ='" + hrcode + "'";

                {
                    Global objGlbl = new Global();
                    DbConn con     = new DbConn();
                    //  HrMaster1 obj =con.DB_master.SingleOrDefault(p => p.HrCode == hrcode);
                    // ServiceReg obj = con.db_SerReg.SingleOrDefault(p => p.Pcode == Password);

                    HrMaster obj = con.Db_hr.SingleOrDefault(p => p.HrCode == hrcode);
                    obj.Password = Password;
                    con.SaveChanges();
                    return("");
                }
            }
            catch
            {
                return("$");
            }
        }
示例#2
0
 public HttpResponseMessage Login(string UserNmae, string Pass, string Device = "")
 {
     string[] strlog = new string[3];
     if ((new Global()).CheckStarterService())
     {
         Global objGlbl = new Global();
         DbConn con     = new DbConn();
         try
         {
             HrMaster obj_HrMaster = con.Db_hr.SingleOrDefault(p => p.HrCode == UserNmae && p.Password == Pass);
             if (obj_HrMaster == null)
             {
                 strlog[0] = "0";
             }
             else
             {
                 if (obj_HrMaster.UserType == 2)
                 {
                     bool    flag = false;
                     DataRow dr   = objGlbl.GetUserLoginsSql(1, "");
                     if (dr == null)
                     {
                         flag = true;
                     }
                     else
                     {
                         int loginuser = (dr["Cnt"] == null) ? 0 : Convert.ToInt16(dr["Cnt"]);
                         int cnt       = 1;
                         try
                         {
                             cnt = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["cnt"]);
                         }
                         catch
                         {
                         }
                         if (loginuser >= cnt)
                         {
                             flag      = false;
                             strlog[0] = "No Of Users Exceed. You Can Not Login...!";
                         }
                         else
                         {
                             flag = true;
                         }
                     }
                     if (flag)
                     {
                         if (objGlbl.GetUserLoginsSql(2, UserNmae) == null)
                         {
                             strlog[0] = "1";
                             strlog[1] = obj_HrMaster.Name;
                             strlog[2] = GetMenu(UserNmae);
                             objGlbl.InsertLoginLog(UserNmae, Device);
                             objGlbl.DBConnInfo(UserNmae);
                         }
                         else
                         {
                             strlog[0] = "Sorry... AlReady LogIn For User " + UserNmae + " !";
                         }
                     }
                 }
                 else
                 {
                     strlog[0] = "Sorry..." + UserNmae + " Is Not Valid Mobile Login User !";
                 }
             }
         }
         catch (Exception ex)
         {
             strlog[0] = ex.Message;
         }
         return(Request.CreateResponse(HttpStatusCode.OK, strlog));
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Your TiaERPApp service is stop!!! To use TiaERP@App Application, start TiaERPApp Service from AppServiceStarter."));
     }
 }