コード例 #1
0
        public bool Delete(TB_ChannelManagerExt model, ref string Msg, Controller ctrl)
        {
            bool status = true;

            var obj = db.TB_ChannelManager.Where(x => x.ID == model.ID).FirstOrDefault();
            db.TB_ChannelManager.Remove(obj);
            db.SaveChanges();

            return status;
        }
コード例 #2
0
        public bool Create(TB_ChannelManagerExt model, ref string Msg, Controller ctrl)
        {
            bool status = true;

            TB_ChannelManager obj = new TB_ChannelManager();
               // obj.ID = model.ID;
            obj.Code = model.Code;
            obj.Name = model.Name;
            obj.Sort = Convert.ToInt16(model.Sorts);
            obj.Active = Convert.ToBoolean(model.Active);
            obj.OpDateTime = DateTime.Now;
            obj.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]);
            db.TB_ChannelManager.Add(obj);
            db.SaveChanges();

            int id = Convert.ToInt32(obj.ID);

            return status;
        }
コード例 #3
0
        public List<TB_ChannelManagerExt> ReadAll(int TableID)
        {
            List<TB_ChannelManagerExt> list = new List<TB_ChannelManagerExt>();
            DataTable dt = new DataTable();
            SQLCon.Open();
            SqlCommand cmd = new SqlCommand("B_DisplayTableNew_BizTbl_Table_Sp", SQLCon);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TableID", TableID);
            cmd.Parameters.AddWithValue("@CultureCode", CultureCode);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(dt);
            SQLCon.Close();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    TB_ChannelManagerExt model = new TB_ChannelManagerExt();
                    model.ID = Convert.ToInt32(dr["ID"]);
                    model.Code = dr["Code"].ToString();
                    model.Name = dr["Name"].ToString();
                    model.Sorts = Convert.ToInt32(dr["Sort"]);
                    model.Active = Convert.ToBoolean(dr["Active"]);
                    list.Add(model);
                }
            }

            return list;
        }
コード例 #4
0
        public bool Update(TB_ChannelManagerExt model, ref string Msg, Controller ctrl)
        {
            bool status = true;

            var obj = db.TB_ChannelManager.Where(x => x.ID == model.ID).FirstOrDefault();
            obj.Code = model.Code;
            obj.Name = model.Name;
            obj.Sort = Convert.ToInt16(model.Sorts);
            obj.Active = Convert.ToBoolean(model.Active);
            obj.OpDateTime = DateTime.Now;
            obj.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]);

            db.SaveChanges();

            return status;
        }