Beispiel #1
0
        public static dynamic SaveAccountAvatar(USUsers dto)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users",
                                                            new string[] { "@flag", "@Id", "@Avatar" },
                                                            new object[] { "SaveAccountAvatar", dto.Id, dto.Avatar });

            return((from r in tabl.AsEnumerable()
                    select new
            {
                N = (int)(r["N"]),
            }).FirstOrDefault());
        }
Beispiel #2
0
        public static dynamic DeleteItem(USUsers dto)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users",
                                                            new string[] { "@flag", "@Id", "@ModifiedBy" },
                                                            new object[] { "DeleteItem", dto.Id, dto.ModifiedBy });

            return((from r in tabl.AsEnumerable()
                    select new
            {
                N = (int)(r["N"]),
            }).FirstOrDefault());
        }
Beispiel #3
0
        public static dynamic SaveAccountInfo(USUsers dto)
        {
            DateTime Birthday = DateTime.Now;

            if (dto.BirthdayShow != null)
            {
                Birthday = DateTime.ParseExact(dto.BirthdayShow, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            dto.Birthday = Int32.Parse(Birthday.ToString("yyyyMMdd"));
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users",
                                                            new string[] { "@flag", "@Id", "@FullName", "@Status", "@Telephone", "@Email", "@Description", "@Gender", "@Password", "@Birthday", "@UserCode", "@Specialize", "@IdRegency" },
                                                            new object[] { "SaveAccountInfo", dto.Id, dto.FullName, dto.Status, dto.Telephone, dto.Email, dto.Description, dto.Gender, dto.Password, dto.Birthday, dto.UserCode, dto.Specialize, dto.IdRegency });

            return((from r in tabl.AsEnumerable()
                    select new
            {
                N = (int)(r["N"]),
            }).FirstOrDefault());
        }
Beispiel #4
0
        public static USUsers GetItem(int Id, string SecretId = null)
        {
            DataTable tabl = ConnectDb.ExecuteDataTableTask(Startup.ConnectionString, "user_users",
                                                            new string[] { "@flag", "@Id" }, new object[] { "GetItem", Id });
            USUsers item = (from r in tabl.AsEnumerable()
                            select new USUsers
            {
                Id = (int)r["Id"],
                IdGroup = (int)r["IdGroup"],
                FullName = (string)((r["FullName"] == System.DBNull.Value) ? "" : r["FullName"]),
                UserName = (string)((r["UserName"] == System.DBNull.Value) ? "" : r["UserName"]),
                UserCode = (string)((r["UserCode"] == System.DBNull.Value) ? "" : r["UserCode"]),
                Specialize = (string)((r["Specialize"] == System.DBNull.Value) ? "" : r["Specialize"]),
                Avatar = (string)((r["Avatar"] == System.DBNull.Value) ? "" : r["Avatar"]),
                Birthday = (int)((r["Birthday"] == System.DBNull.Value) ? Int32.Parse(DateTime.Now.ToString("yyyyMMdd")) : r["Birthday"]),
                Status = (byte)r["Status"],
                Gender = (byte)r["Gender"],
                Email = (string)((r["Email"] == System.DBNull.Value) ? "" : r["Email"]),
                Description = (string)((r["Description"] == System.DBNull.Value) ? "" : r["Description"]),
                Telephone = (string)((r["Telephone"] == System.DBNull.Value) ? "" : r["Telephone"]),
                IdCoQuan = (int)((r["IdCoQuan"] == System.DBNull.Value) ? 0 : r["IdCoQuan"]),
                IdRegency = (int)((r["IdRegency"] == System.DBNull.Value) ? 0 : r["IdRegency"]),
                Ids = MyModels.Encode((int)r["Id"], SecretId)
            }).FirstOrDefault();

            if (item.Birthday == 0)
            {
                item.BirthdayShow = DateTime.Now.ToString("dd/MM/yyyy");
            }
            else
            {
                item.BirthdayShow = DateTime.ParseExact(item.Birthday.ToString(), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("dd/MM/yyyy");
            }

            return(item);
        }