Exemple #1
0
 public Manager(ZamerModels zamer, RaschetModels raschet, DateTime date, int managerId, string managerName, int status, string comments, int id)
 {
     Raschet     = raschet;
     Zamer       = zamer;
     Date        = date;
     ManagerId   = managerId;
     ManagerName = managerName;
     Status      = status;
     Comments    = comments;
     Id          = id;
 }
Exemple #2
0
        public static ZamerModels GetInfo(int userId)
        {
            DataTable dt = GetData("select top 1 * from UserProfile where UserId = " + userId);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(null);
            }
            ZamerModels result = new ZamerModels((int)dt.Rows[0]["UserId"], dt.Rows[0]["UserName"].ToString(), dt.Rows[0]["PhoneNumber"].ToString(), dt.Rows[0]["Address"].ToString());

            return(result);
        }
Exemple #3
0
        public static bool SetZakaz(ZamerModels model)
        {
            string myConnString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();

            if (string.IsNullOrEmpty(myConnString))
            {
                return(false);
            }

            string queryString = String.Format(String.Format(@"Insert into Zamer (UserName, Phone, Address, Time, UserId, Date, ManagerId, ManagerName, Status) VALUES(N'{0}', N'{1}', N'{2}', N'{3}', {4}, @date, 0, ' ', 1) SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY]", (string)model.UserName, (string)model.Phone, (string)model.Address, (string)model.Time, (int)model.UserId));

            SqlConnection conn    = new SqlConnection(myConnString);
            SqlCommand    command = new SqlCommand(queryString, conn);

            command.Parameters.Add("@date", SqlDbType.DateTime);
            command.Parameters["@date"].Value = DateTime.Now;

            conn.Open();
            command.ExecuteNonQuery();
            conn.Close();

            return(true);
        }