Exemplo n.º 1
0
        public void Update(MasterMenuView model)
        {
            using (var ctx = new ConXContext())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    string           strConn  = ConfigurationManager.ConnectionStrings["OracleDbContext"].ConnectionString;
                    var              dataConn = new OracleConnectionStringBuilder(strConn);
                    OracleConnection conn     = new OracleConnection(dataConn.ToString());

                    conn.Open();

                    OracleCommand     oraCommand = conn.CreateCommand();
                    OracleParameter[] param      = new OracleParameter[]
                    {
                        new OracleParameter("p_menu_id", model.menuFunctionId),
                        new OracleParameter("p_menu_name", model.menuFunctionName),
                        new OracleParameter("p_main_menu", model.menuFunctionGroupId),
                        new OracleParameter("p_link_name", model.menuURL),
                        new OracleParameter("p_icon_name", model.iconName),
                    };
                    oraCommand.BindByName = true;
                    oraCommand.Parameters.AddRange(param);
                    oraCommand.CommandText = "update su_menu set menu_name = :p_menu_name , main_menu =:p_main_menu , link_name = :p_link_name , icon_name =:p_icon_name  where menu_id = :p_menu_id";


                    oraCommand.ExecuteNonQuery();

                    conn.Close();


                    scope.Complete();
                }
            }
        }
Exemplo n.º 2
0
        public void Update(MasterMenuView model)
        {
            using (var ctx = new ConXContext())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    MenuFunction updateObj = ctx.MenuFunctions.Where(z => z.menuFunctionId == model.menuFunctionId).SingleOrDefault();

                    updateObj.menuFunctionId      = model.menuFunctionId;
                    updateObj.menuFunctionGroupId = model.menuFunctionGroupId;
                    updateObj.menuFunctionName    = model.menuFunctionName;
                    updateObj.menuURL             = model.menuURL;
                    updateObj.iconName            = model.iconName;
                    updateObj.orderDisplay        = model.orderDisplay;
                    ctx.SaveChanges();
                    scope.Complete();
                }
            }
        }
Exemplo n.º 3
0
        public HttpResponseMessage postUpdate(MasterMenuView model)
        {
            try
            {
                //check dupplicate Code
                //var isDupplicate = menuGroupSvc.CheckDupplicate(model.menuFunctionGroupId);
                //if (isDupplicate)
                //{
                //    return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, string.Format("รหัสกลุ่มเมนู {0} มีอยู่ในระบบแล้ว", model.menuFunctionGroupId));
                //}

                menuSvc.Update(model);

                return(Request.CreateResponse(HttpStatusCode.OK, "บันทึกข้อมูลสำเร็จ"));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()));
            }
        }
Exemplo n.º 4
0
        public void Create(MasterMenuView model)
        {
            using (var ctx = new ConXContext())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    MenuFunction newObj = new MenuFunction()
                    {
                        menuFunctionId      = model.menuFunctionId,
                        menuFunctionGroupId = model.menuFunctionGroupId,
                        menuFunctionName    = model.menuFunctionName,
                        menuURL             = model.menuURL,
                        iconName            = model.iconName,
                        orderDisplay        = model.orderDisplay
                    };

                    ctx.MenuFunctions.Add(newObj);
                    ctx.SaveChanges();
                    scope.Complete();
                }
            }
        }