示例#1
0
        }         //End public static void AutocreateYear(ActionExecutedContext context)

        public static Boolean isValidDBLogin(string psUsername, string psPassword, int?pnMdleId)
        {
            UserloginVM oVM = new UserloginVM();;


            //if Ultimate User
            if ((psUsername.ToUpper() == valDFLT.SYSADMIN_USER) && (psPassword == valDFLT.SYSADMIN_PASSWORD))
            {
                setValidCredential(psUsername, valDFLT.SYSADMIN_USER, null, null, hlpConfig.ConstantaInfo.MDLE_ID);
                return(true);
            } //End if ((psUsername.ToUpper() == "SYSADMIN") && (psPassword == "kuy4bulu5"))

            //if selain Ultimate User
            UserDS oDS  = new UserDS();
            var    oQRY = oDS.getData_Usercredential(psUsername);

            if (oQRY != null)
            {
                string stes = hlpObf.randomDecrypt(oQRY.PASSWORD);
                if ((psUsername.ToUpper() == oQRY.USERNAME.ToUpper()) &&
                    (psPassword == hlpObf.randomDecrypt(oQRY.PASSWORD)))
                {
                    //setValidCredential(psUsername, oQRY.DISPLAY_NAME, oQRY.ID, oQRY.ROLE_ID, hlpConfig.ConstantaInfo.MDLE_ID);
                    setValidCredential(psUsername, oQRY, hlpConfig.ConstantaInfo.MDLE_ID);
                    return(true);
                } //End if ((psUsername.ToUpper() == oQRY.USERNAME) &&
            }     //End if (oQRY != null)
            return(false);
        }         //End public static Boolean isValidDBLogin
示例#2
0
        } //End public static Boolean isValidDBLogin

        public static void isValidCredential(ActionExecutedContext context)
        {
            //Validate Is User logged in
            if ((hlpConfig.SessionInfo.getAppUsrID() == "") ||
                (hlpConfig.SessionInfo.getAppUsrID() == null))
            {
                context.Result = new RedirectToRouteResult(new RouteValueDictionary
                {
                    { "controller", "Account" },
                    { "action", "Login" }
                });

                //HttpContext.Current.Response.Redirect("~/Account/Login");
            } //End if ((hlpConfig.SessionInfo.getAppUsrID() == "") ||

            //Validate user access control
            string sAC_MENU_RUID = context.Controller.ViewBag.AC_MENU_RUID;

            if (sAC_MENU_RUID != null)
            {
                if (sAC_MENU_RUID != APPBASE.Svcbiz.valFLAG.FLAG_ROLE_SYSADMIN)
                {
                    UserDS  oDS     = new UserDS();
                    Boolean isValid = oDS.isGranted_menu(sAC_MENU_RUID);
                    if (!isValid)
                    {
                        context.Result = new RedirectToRouteResult(new RouteValueDictionary
                        {
                            { "controller", "Error" },
                            { "action", "Error403" }
                        });
                    } //End if (!isValid)
                }     //End if (sAC_MENU_RUID != APPBASE.Svcbiz.valFLAG.FLAG_ROLE_SYSADMIN)
            }         //End if (sAC_MENU_RUID != null)
        }             //End public static string isValidCredential
示例#3
0
 //Init
 private void initConstructor(DBMAINContext poDB)
 {
     //DBContext
     this.db = poDB;
     //DS
     this.oDS = new UserDS(this.db);
     this.oDSRole = new RoleDS();
     //CRUD
     this.oCRUD = new UserCRUD(this.db);
     //BL
     //MAP
 } //End initConstructor
示例#4
0
 /// <summary>
 /// Return register from User table based on login details.
 /// </summary>
 /// <param name="userName">string userName</param>
 /// <param name="password">string password</param>
 /// <returns>UserDS.TabUserDataTable</returns>
 /// <exception cref="ex">Exception</exception>
 public UserDS.TabUserDataTable GetLogin(string userName, string password)
 {
     try
     {
         _userDataSet = new UserDS();
         _tabUserTableAdapter.FillByUserNamePassword(_userDataSet.TabUser, userName, password);
         return(_userDataSet.TabUser);
     }
     catch (Exception ex)
     {
         //Error log simulate
         Console.WriteLine(ex.ToString());
         Console.WriteLine(ex.GetBaseException().ToString());
         throw;
     }
 }
示例#5
0
 /// <summary>
 /// Returns all registers from User table.
 /// </summary>
 /// <returns>UserDS.TabUserDataTable</returns>
 /// <exception cref="ex">Exception</exception>
 public UserDS.TabUserDataTable GetAllUser()
 {
     try
     {
         _userDataSet = new UserDS();
         _tabUserTableAdapter.FillAllUsers(_userDataSet.TabUser);
         return(_userDataSet.TabUser);
     }
     catch (Exception ex)
     {
         //Error log simulate
         Console.WriteLine(ex.ToString());
         Console.WriteLine(ex.GetBaseException().ToString());
         throw;
     }
 }
示例#6
0
 /// <summary>
 /// Search Users by UserName.
 /// </summary>
 /// <param name="userName">string userName</param>
 /// <returns>UserDS.TabUserDataTable</returns>
 /// <exception cref="ex">Exception</exception>
 public UserDS.TabUserDataTable GetUsersByUserName(string userName)
 {
     try
     {
         userName     = "******" + userName + "%";
         _userDataSet = new UserDS();
         _tabUserTableAdapter.FillByUserName(_userDataSet.TabUser, userName);
         return(_userDataSet.TabUser);
     }
     catch (Exception ex)
     {
         //Error log simulate
         Console.WriteLine(ex.ToString());
         Console.WriteLine(ex.GetBaseException().ToString());
         throw;
     }
 }
示例#7
0
        //public static Boolean
        public static Boolean isValidDBLogin(string psUserID, string psPassword, string psMdleRUID)
        {
            Boolean vReturn          = false;
            string  vsUserID         = psUserID.ToUpper();
            string  vsUserPassword   = psPassword;
            string  vsMdleRUID       = psMdleRUID.ToUpper();
            string  vsUserIDDS       = null;
            string  vsUserPasswordDS = null;
            string  vsUserRUIDDS     = null;
            string  vsUserRES_RUID   = "";

            try
            {
                using (var db = new DBMAINContext())
                {
                    //modAccessControl.LoginInfo LoginInfoDS = new modAccessControl.LoginInfo(vsUserID);

                    //var qryLogin = db.Users
                    //    .Select(fld => new {fld.RUID, fld.USR_ID, fld.USR_PSWD, fld.RES_RUID})
                    //    .SingleOrDefault(fld => fld.USR_ID.ToUpper() == vsUserID);

                    UserDS oDSUser  = new UserDS();
                    var    qryLogin = oDSUser.getData_byUSR_ID(vsUserID);

                    //vsUserIDDS = qryLogin.USR_ID.ToString();
                    vsUserIDDS       = qryLogin.USR_ID.ToUpper();
                    vsUserPasswordDS = hlpObf.randomDecrypt(qryLogin.USR_PSWD.ToString());
                    vsUserRUIDDS     = qryLogin.RUID.ToString();
                    if (qryLogin.RES_RUID != null)
                    {
                        vsUserRES_RUID = qryLogin.RES_RUID.ToString();
                    } //End if
                    if ((vsUserID == vsUserIDDS) && (vsUserPassword == vsUserPasswordDS))
                    {
                        //setValidCredential(psUserID, vsUserRUIDDS, vsMdleRUID, hlpGeneral.FlagInfo.getFlagValid());
                        setValidCredential(vsMdleRUID, qryLogin);
                        setEmployee_Jobinfo(qryLogin);
                        vReturn = true;
                    }   //End if
                }       //End using (var db = new DBMAINContext())
            }           //End try
            catch (Exception e) { vsUserIDDS = e.Message; }
            finally { } //End finally

            return(vReturn);
        } //End public static Boolean isValidDBLogin
        public ActionResult CreateUser(FormCollection collection)
        {
            try
            {
                var user = new UserDS
                {
                    UserName  = collection["UserName"],
                    Direction = collection["Direction"],
                    Nit       = int.Parse(collection["Nit"])
                };

                if (user.UserName == "" && user.Direction == "")
                {
                    ViewBag.Error = "No ingreso su Direccón y Nombre";
                    return(View());
                }
                else if (user.UserName == "")
                {
                    ViewBag.Error = "No ingreso su nombre";
                    return(View());
                }
                else if (user.Direction == "")
                {
                    ViewBag.Error = "No ingreso su Direccón";
                    return(View());
                }
                else
                {
                    Storage.Instance.user = user;
                    return(RedirectToAction("Order", "Order"));
                }
            }
            catch (Exception)
            {
                ViewBag.Error = "No ingreso su nit";
                return(View());
            }
        }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     UserDS ds = new UserDS();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "UserDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     UserDS ds = new UserDS();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
示例#11
0
 public string InUpDeUser(User user)
 {
     return(UserDS.InsUpdDelUser(user));
 }
示例#12
0
 public List <User> GetUserById(int userid)
 {
     return(UserDS.GetUserById(userid));
 }
示例#13
0
        } //End public static string isValidCredential

        public static Boolean isGranted_menu(string psAC_MENU_RUID)
        {
            UserDS oDS = new UserDS();

            return(oDS.isGranted_menu(psAC_MENU_RUID));
        } //End public static Boolean isValidMenu(string psAC_MENU_RUID)
示例#14
0
 public BaseViewModel()
 {
     Employees = new ObservableCollection <Employee>();
     UserDS.CreateTableAsync();
     EmployeesDS.CreateTableAsync();
 }
示例#15
0
 public UserDAO()
 {
     //Initialize objects
     _userDataSet         = new UserDS();
     _tabUserTableAdapter = new TabUserTableAdapter();
 }
示例#16
0
        private TabUserTableAdapter tabUserTableAdapter; //uses sql to talk to db tables and DataTables

        public UserDAO()
        {
            //build objs to reference of these types
            userDataSet         = new UserDS();
            tabUserTableAdapter = new TabUserTableAdapter();
        }
示例#17
0
        private TabUserTableAdapter tabUserAdapter; //this class was autogenerated by our userDS query configure stage

        public UserDAO()
        {
            userDataSet    = new UserDS();
            tabUserAdapter = new TabUserTableAdapter();
        }
示例#18
0
 public List <User> GetAllUser()
 {
     return(UserDS.GetAllUsers());
 }