Пример #1
0
        public static void AddEmployee(Employee employee)
        {
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("@ID", employee.ID);
            param.Add("@Name", employee.Name);
            param.Add("@EmailId", employee.EmailId);
            param.Add("@MobileNo", employee.MobileNo);
            param.Add("@UserName", employee.UserName);
            param.Add("@Password", StringCipher.Encrypt(employee.Password));
            param.Add("@Type", (employee.Type == null ? "" : employee.Type));
            param.Add("@PhotoPath", (employee.PhotoPath == null ? "" : employee.PhotoPath));
            param.Add("@CreatedBy", employee.CreatedBy);
            param.Add("@UpdatedBy", employee.UpdatedBy);
            DBHelper.ExecuteNonQuery("AddEmployee", param, true);
        }
Пример #2
0
        public static Employee CheckUserByUserNameAndPassword(string UserName, string Password)
        {
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("@UserName", UserName);
            param.Add("@Password", StringCipher.Encrypt(Password));
            DataTable dt = DBHelper.GetDataTable("CheckUserByUserNameAndPassword", param, true);

            if (dt != null && dt.Rows.Count > 0)
            {
                return(DBHelper.ConvertToEnumerable <Employee>(dt).FirstOrDefault());
            }
            else
            {
                return(null);
            }
        }