示例#1
0
文件: db.cs 项目: Nikolay4/Kitchen
        public static bool Set_Raschet(RaschetModels model)
        {
            string myConnString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();

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

            string queryString = String.Format(@"
                            INSERT INTO Online_Serv
                            (UserId, UserName,Type, Form, Wishes, Date, ManagerId, ManagerName, Status, Comments)
                           VALUES        ({0}, N'{4}',{1}, {2}, N'{3}', @date, 0, ' ', 1, ' ')"
                                               , model.UserId, (int)model.Type, model.Form, model.Text, GetUserName(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);
        }
示例#2
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;
 }