internal B2b_com_blackoutdates Getblackoutdate(string daydate, int comid)
        {
            try
            {
                string sql = "select * from b2b_com_blackoutdates where comid=" + comid + " and convert(varchar(10), blackoutdate,120)='" + DateTime.Parse(daydate).ToString("yyyy-MM-dd") + "'";

                var cmd = sqlHelper.PrepareTextSqlCommand(sql);
                using (var reader = cmd.ExecuteReader())
                {
                    B2b_com_blackoutdates m = null;
                    if (reader.Read())
                    {
                        m = new B2b_com_blackoutdates
                        {
                            id           = reader.GetValue <int>("id"),
                            blackoutdate = reader.GetValue <DateTime>("blackoutdate"),
                            datetype     = reader.GetValue <int>("datetype"),
                            comid        = reader.GetValue <int>("comid"),
                            operid       = reader.GetValue <int>("operid"),
                            opertime     = reader.GetValue <DateTime>("opertime")
                        };
                    }
                    return(m);
                }
            }
            catch
            {
                sqlHelper.Dispose();
                return(null);
            }
        }
        internal int InsB2b_com_blackoutdates(B2b_com_blackoutdates model)
        {
            string sql = "INSERT INTO b2b_com_blackoutdates ( [blackoutdate],[datetype],[comid],[operid],[opertime]) VALUES('" + model.blackoutdate + "'," + model.datetype + " ," + model.comid + " ," + model.operid + ",'" + model.opertime + "')";

            var cmd = sqlHelper.PrepareTextSqlCommand(sql);

            return(cmd.ExecuteNonQuery());
        }
Ejemplo n.º 3
0
 public int InsB2b_com_blackoutdates(B2b_com_blackoutdates model)
 {
     using (var helper = new SqlHelper())
     {
         int r = new Internalb2b_com_blackoutdates(helper).InsB2b_com_blackoutdates(model);
         return(r);
     }
 }