public IHttpActionResult PostCategorys(Categorys categorys)
        {
            if (categorys != null)
            {
                if (categorys.Listproducts == null)
                {
                    categorys.Listproducts = new Collection <Products>();
                }
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //db.Categorys.Add(categorys);

            try
            {
                DataStore <Categorys> .Add(categorys);
            }
            catch (DbUpdateException)
            {
                if (CategorysExists(categorys.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = categorys.ID }, categorys));
        }
예제 #2
0
        public static void ChangePlayerMoney(Client player, float amount, bool bankPay,
                                             Categorys category, string reason, string additionalDataAsJson)
        {
            float money = bankPay ? GetPlayerBank(player) : GetPlayerMoney(player);

            if (bankPay)
            {
                player.setSyncedData("BankAccount", money + amount);
            }
            else
            {
                player.setSyncedData("Money", money + amount);
            }

            MySqlCommand logInsertCommand = TTRPG.Mysql.Conn.CreateCommand();

            logInsertCommand.CommandText = "INSERT INTO log_player_money (UserID, Typ, Category, Amount, Reason, AdditionalData) VALUES (@UserID, @Typ, @Category, @Amount, @Reason, @AdditionalData)";
            logInsertCommand.Parameters.AddWithValue("@UserID", player.getSyncedData("ID"));
            logInsertCommand.Parameters.AddWithValue("@Typ", bankPay ? "BANKACCOUNT" : "MONEY");
            logInsertCommand.Parameters.AddWithValue("@Category", category);
            logInsertCommand.Parameters.AddWithValue("@Amount", Math.Round(amount, 2));
            logInsertCommand.Parameters.AddWithValue("@Reason", reason);
            logInsertCommand.Parameters.AddWithValue("@AdditionalData", additionalDataAsJson);

            logInsertCommand.ExecuteNonQuery();

            RefreshPlayerMoneyDisplay(player);
        }
        public IActionResult Edit(int?id, [Bind("id,Name,Created,Updated")] Categorys categorys)
        {
            if (id != categorys.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Context _context = HttpContext.RequestServices.GetService(typeof(Context)) as Context;
                    _context.Edit(id, categorys);
                }
                catch
                {
                    if (!CategoryExists(categorys.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Categorys"));
            }
            return(View(categorys));
        }
예제 #4
0
        public static bool Write(Categorys categorys, string Key, string Value)
        {
            string CategoryName = null;

            switch (categorys)
            {
            case Categorys.VISUALS:
                CategoryName = "Visuals";
                break;

            case Categorys.ASSISTS:
                CategoryName = "Assists";
                break;

            case Categorys.AIM:
                CategoryName = "Aim";
                break;

            case Categorys.MISCS:
                CategoryName = "Miscs";
                break;

            case Categorys.SKINCHANGER:
                CategoryName = "SkinChanger";
                break;

            case Categorys.SETTINGS:
                CategoryName = "Settings";
                break;
            }

            IsINIFileExitsOrCreate();

            return(NativeMethods.WritePrivateProfileString(CategoryName, Key, Value, INIPath));
        }
 private void SetData()
 {
     try
     {
         if (vsId > 0)
         {
             Categorys  obj    = null;
             BaseEntity entity = new BaseEntity();
             obj = CategoryBL.Instance.Category_Get_ById(ref entity, vsId);
             if (entity.Errors.Count == 0)
             {
                 if (obj != null)
                 {
                     SetControls(obj);
                 }
                 else
                 {
                     SetControls();
                 }
             }
             else
             {
                 Message(EnumAlertType.Error, "An error occurred while loading data");
             }
         }
     }
     catch (Exception)
     {
         Message(EnumAlertType.Error, "An error occurred while loading data");
     }
 }
예제 #6
0
        public async Task <IActionResult> PutCategorys(int id, Categorys categorys)
        {
            if (id != categorys.Id)
            {
                return(BadRequest());
            }

            _context.Entry(categorys).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategorysExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #7
0
        public Categorys Category_Get_ById(ref BaseEntity Base, Int32 Id)
        {
            Categorys     objBrand = new Categorys();
            SqlDataReader dr       = null;
            SqlCommand    cmd      = null;

            try
            {
                cmd = new SqlCommand("Category_Get_ById_Sp", clsConnection.GetConnection())
                {
                    CommandType = CommandType.StoredProcedure
                };
                cmd.Parameters.AddWithValue("@id", Id);
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    objBrand = Category_GetEntity(dr);
                }
            }
            catch (Exception ex)
            {
                objBrand = null;
                Base.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  getting a AppResource by it's Id."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(objBrand);
        }
        private void SetControls(Categorys objCategory)
        {
            try
            {
                hfCategoryId.Value            = objCategory.ID.ToString();
                txtName.Text                  = objCategory.Name;
                txtDescription.Text           = objCategory.Description;
                chkEnable.Checked             = objCategory.Status == (int)EnumStatus.Enabled ? true : false;
                rbFile.Checked                = objCategory.IsUpload == 1 ? true : false;
                rbLink.Checked                = objCategory.IsUpload == 0 ? true : false;
                ddlResourceType.SelectedValue = objCategory.DocType;
                if (rbFile.Checked == true)
                {
                    hfPathImage.Value     = objCategory.NameResource;
                    hfFileExtension.Value = objCategory.FileExtension;
                    hfFileName.Value      = objCategory.FileName;
                    hfPublicName.Value    = objCategory.FilePublicName;
                }
                else
                {
                    //txtLink.Text = objProduct.NameResource;
                    txtLink.Text = Config.EnterpriseVirtualPathCategory + EnumFolderSettings.FolderImages.GetStringValue() + objCategory.FilePublicName;
                }

                Page.ClientScript.RegisterStartupScript(GetType(), "DivfileDivLink", "fn_hide_show();", true);
            }
            catch (Exception ex)
            {
                Message(EnumAlertType.Error, "An error occurred while loading data");
            }
        }
예제 #9
0
        public Int32 Get_QuantityLegalDocuments(ref BaseEntity Entity, Categorys resource)
        {
            Int32      quantity = -1;
            SqlCommand cmd      = null;

            try
            {
                cmd = new SqlCommand("Category_QuantityLegalDocuments_Sp", clsConnection.GetConnection())
                {
                    CommandType = CommandType.StoredProcedure
                };
                cmd.Parameters.AddWithValue("@categoryId", resource.ID);
                //cmd.Parameters.AddWithValue("@productId", resource.ID);
                SqlParameter outputParam = cmd.Parameters.Add("@quantity", SqlDbType.Int);
                outputParam.Direction = ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                if (!String.IsNullOrEmpty(cmd.Parameters["@quantity"].Value.ToString()))
                {
                    quantity = Convert.ToInt32(cmd.Parameters["@quantity"].Value);
                }
            }
            catch (Exception ex)
            {
                quantity = -1;
                Entity.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  deleting a resource."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(quantity);
        }
        public IHttpActionResult PostProduct(Products product, Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Categorys cat = DataStore <Categorys> .Find(id);

            cat.Listproducts.Add(product);
            //db.Categorys.Add(categorys);

            try
            {
                DataStore <Categorys> .Update(cat);
            }
            catch (DbUpdateException)
            {
                if (!CategorysExists(cat.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = product.ID }, product));
        }
예제 #11
0
        public async Task <ActionResult <Categorys> > PostCategorys(Categorys categorys)
        {
            _context.Categorys.Add(categorys);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCategorys", new { id = categorys.Id }, categorys));
        }
        public JsonResult CreatedCategory(string name)
        {
            try
            {
                var userCPF       = HttpContext.Request.Cookies["UserCPF"];
                var categoryExist = rep._context.Categorys.FirstOrDefault(s => s.Name.Equals(name));
                if (categoryExist == null)
                {
                    var category = new Categorys();
                    category.Name       = name;
                    category.Created_at = Common.Commons.HourBrasilia;
                    category.UserID     = rep.GetUserByCPF(userCPF).UserID;

                    rep._context.Categorys.Add(category);
                    rep._context.SaveChanges();
                    return(Json(category));
                }
                else
                {
                    return(new JsonResult("Categoria já existe.")
                    {
                        StatusCode = (int)HttpStatusCode.BadRequest
                    });
                }
            }
            catch (Exception)
            {
                return(new JsonResult("Houve um erro interno, já estamos verificando.")
                {
                    StatusCode = (int)HttpStatusCode.BadRequest
                });
            }
        }
예제 #13
0
 /*선택한 값의 객체 설정 및 txtbox 값 업데이튼*/
 private void select_Function(int select_value)
 {
     select_cate          = select_value;
     currentcate          = Db_Cate.ReadCategorys(select_cate);
     select_cateS         = currentcate.Category;
     txtbox_Category.Text = currentcate.Category;
 }
        public IHttpActionResult PutCategorys(Guid id, Categorys categorys)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != categorys.ID)
            {
                return(BadRequest());
            }

            //db.Entry(categorys).State = EntityState.Modified;

            try
            {
                DataStore <Categorys> .Update(categorys);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategorysExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #15
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Parent,Slug,Status,CreatedAt,UpdatedAt")] Categorys categorys)
        {
            if (id != categorys.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categorys);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategorysExists(categorys.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categorys));
        }
예제 #16
0
        public ActionResult OnPostCategoryCheck([FromBody] Categorys categorys)
        {
            DataSet dstresult = new DataSet();

            dstresult = _transactionRepository.CategoryCheck(categorys.dbvalue);

            return(new JsonResult(dstresult));
        }
예제 #17
0
        public static string KategoriSeoLink(this UrlHelper urlHelper, Categorys entity)
        {
            string title = entity.Category_Name;
            int    id    = entity.Category_Id;

            title = FriendlyURLTitle(title);
            return(string.Format("/kategori/liste/{0}/{1}", id, title));
        }
예제 #18
0
 public static void InsertCategory(Categorys category)
 {
     using (SuuxEntities ent = new SuuxEntities())
     {
         ent.Categorys.Add(category);
         ent.SaveChanges();
     }
 }
예제 #19
0
 public static void UpdateCategory(Categorys category)
 {
     using (SuuxEntities ent = new SuuxEntities())
     {
         ent.Categorys.Attach(category);
         ent.Entry(category).State = System.Data.Entity.EntityState.Modified;
         ent.SaveChanges();
     }
 }
예제 #20
0
 /// <summary>
 /// Returns a random value from enum of type T
 /// </summary>
 private T RandomEnum <T>(Categorys fromCategory)
 {
     if (typeof(T).IsEnum)
     {
         int i = random.Next(0, 2) + (int)fromCategory * 2;
         return((T)(object)i);
     }
     throw new ArgumentException("T must be an enumerated type");
 }
예제 #21
0
 private void lv_Category_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //리스트 선택한 값을 객체에 할당
     if (lv_Category.SelectedIndex != -1)
     {
         Categorys listitem = lv_Category.SelectedItem as Categorys;
         select_Function(listitem.Id);
     }
 }
예제 #22
0
        public ActionResult Edit(Categorys parametre)
        {
            var ktgr = db.Categorys.Find(parametre.Category_Id);

            ktgr.Category_Name    = parametre.Category_Name.ToString();
            ktgr.Category_Ranking = Convert.ToInt32(parametre.Category_Ranking);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #23
0
 public void Delete(Categorys categorys)
 {
     categorys = db.Categorys.FirstOrDefault();
     if (categorys != null)
     {
         db.Categorys.Remove(categorys);
         db.SaveChanges();
     }
 }
예제 #24
0
 private void cb_Category_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //콤보박스 값을 선택 시 객체 할당
     if (cb_Category.SelectedIndex != -1)
     {
         Categorys cb_item = cb_Category.SelectedItem as Categorys;
         cb_select_cate = cb_item.category;
         POS_SalePro_Refresh();
     }
 }
예제 #25
0
 public ActionResult Create(Categorys categorys)
 {
     if (ModelState.IsValid)
     {
         db.Categorys.Add(categorys);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
예제 #26
0
 public ActionResult Edit(Categorys categorys)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categorys).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categorys));
 }
예제 #27
0
        // GET: Categorys/Delete/5
        public ActionResult Delete(int id)
        {
            Categorys categorys = db.Categorys.Find(id);

            if (categorys == null)
            {
                return(HttpNotFound());
            }
            return(View(categorys));
        }
예제 #28
0
 /*카테고리 데이터베이스 값 삽입하는 함수*/
 public void InsertCategory(Categorys newcate)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.RunInTransaction(() =>
         {
             dbConn.Insert(newcate);
         });
     }
 }
 public ActionResult Put(int id, [FromBody] Categorys cat)
 {
     if (id != cat.Id)
     {
         return(BadRequest());
     }
     _Data.Entry(cat).State = EntityState.Modified;
     _Data.SaveChanges();
     return(Ok());
 }
        public Boolean Category_Save(ref BaseEntity Entity, Categorys Category, Boolean RegisterTBL = false, String Username = "")
        {
            Boolean success = false;

            Entity = new BaseEntity();

            success = CategoryDao.Instance.Category_Save(ref Entity, Category, RegisterTBL, Username);

            return(success);
        }