Example #1
0
    public static List <ItemBLL> DALGetAllAttribute(ItemCategoryBLL ic)
    {
        List <ItemBLL> ctList = new List <ItemBLL>();

        using (SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]))
        {
            try
            {
                SqlParameter[] par = new SqlParameter[2];
                par[0]           = new SqlParameter("@categoryId", ic.categoryICId);
                par[1]           = new SqlParameter("@Status", 11);
                par[1].Direction = ParameterDirection.Output;
                using (SqlDataReader dr = SqlHelper.ExecuteReader(con, CommandType.StoredProcedure, "spSelectAttributeByCategory", par))
                {
                    while (dr.Read())
                    {
                        ItemBLL itl = new ItemBLL();
                        itl.attributeId = Convert.ToInt32(Convert.ToString(dr["attributeId"]));
                        ctList.Add(itl);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        return(ctList);
    }
Example #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         itemBLL = new ItemBLL();
         string iditem = txtIditem.Text;
         iditem = iditem.ToUpper().ToString();
         if (!itemBLL.verifyitem(iditem))
         {
             MessageBox.Show(this, "Wrong item ID", "ERROR!");
             txtIditem.Focus();
             txtIditem.SelectAll();
         }
         else
         {
             if (!receiptBLL.verifyreceiptdetail(iditem))
             {
                 MessageBox.Show(this, "This item is already exists!", "ERROR!");
                 txtIditem.Focus();
                 txtIditem.SelectAll();
             }
             else
             {
                 lbMaxquantity.Text  = "/ " + itemBLL.getmaxquantity().ToString();
                 txtQuantity.Maximum = itemBLL.getmaxquantity();
                 enablequantity();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERROR");
     }
 }
        public JsonResult AddItemToCart(int id, string mySessionID)
        {
            if(mySessionID != null)
            {
                var myCart = ShoppingCartManager.getInstance().getMyShoppingCart(mySessionID);

                if(myCart == null)
                {
                    myCart = new ShoppingCart();
                    myCart.Items = new List<Item>();
                    ShoppingCartManager.getInstance().addShoppingCartToList(myCart);
                }
                var newItem = new ItemBLL().GetById(id);
                if (newItem.InStock > 0) {

                    myCart.Items.Add(newItem);
                    myCart.SessionID = mySessionID;
                    ShoppingCartManager.getInstance().updateCartTotalPrice(myCart);

                    return this.Json(myCart);
                }

            }
            return null;
        }
Example #4
0
        protected void btnItem_Click(object sender, EventArgs e)
        {
            ItemBLL objBll = new ItemBLL();

            objBll.GetItemsNoPicutre();
            SessionSet.PageMessage = "整理成功!";
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            {
                string idpedido = Request["IDPedido"];

                if (idpedido != null)
                {
                    PedidoBLL         pbll  = new PedidoBLL();
                    PessoaFisicaBLL   pfbll = new PessoaFisicaBLL();
                    PessoaJuridicaBLL pjbll = new PessoaJuridicaBLL();
                    ItemBLL           ibll  = new ItemBLL();
                    ProdutoBLL        prbll = new ProdutoBLL();

                    var pedido = pbll.GetPedido(idpedido);
                    lblCodigoPedido.Text   = pedido.CodigoPedido;
                    lblNomePessoa.Text     = pfbll.GetPessoaFisica(pedido.CodigoComprador).NomePessoa;
                    lblNomeFornecedor.Text = pjbll.GetPessoaJuridica(pedido.CodigoVendedor).NomePessoa;

                    var            items    = ibll.GetItems().Where(p => p.CodigoPedido == pedido.CodigoPedido).ToList();
                    double         total    = 0;
                    List <Produto> produtos = new List <Produto>();
                    foreach (var item in items)
                    {
                        //var produto = prbll.GetProduto(item.CodigoProduto);
                        //produtos.Add(produto);
                        total += double.Parse(item.ValorTotal);
                        //labelitens += "<br/>Produto: "+produto.Nome+"| Qtd: "+item.Qtd+"| Preço: "+produto.Preco;
                    }
                    grvProdutos.DataSource = items;
                    grvProdutos.DataBind();
                    lblTotal.Text = total.ToString();
                }
            }
        }
        //数据加载(修改进入)
        private void DataLoadForEdit(int itemID)
        {
            //加载主题数据
            ItemBLL itemBLL = new ItemBLL();

            RailExam.Model.Item mainItem = itemBLL.GetItem(itemID);
            if (mainItem != null)
            {
                DataLoadForEditOnMain(mainItem);
                //主题加载完之后加载第一小题
                txtTestCount_TextChanged(null, null);
                this.dropTestNo.SelectedValue = "1";
                //保存当前变化前的题号
                this.hfTestNoBefore.Value = "1";

                IList <RailExam.Model.Item> subItemList = itemBLL.GetItemsByParentItemID(itemID);
                foreach (RailExam.Model.Item item in subItemList)
                {
                    if (item.ItemIndex.ToString() == "1")
                    {
                        //加载第一题
                        DataLoadForEditOnSubsidiary(item);
                        break;
                    }
                }
            }
        }
        //切换题号后保存刚才一小题的数据,并显示新小题的数据
        protected void dropTestNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DataCheck())
            {
                int testNo = Int32.Parse(this.hfTestNoBefore.Value);
                switch (this.hfMode.Value)
                {
                case "insert":
                    DataInsert(testNo);
                    this.hfTestNoBefore.Value = this.dropTestNo.SelectedValue;
                    break;

                case "edit":
                    DataUpdate(testNo);
                    //加载下一题
                    ItemBLL itemBLL = new ItemBLL();
                    IList <RailExam.Model.Item> subItemList = itemBLL.GetItemsByParentItemID(Convert.ToInt32(this.Request["id"]));
                    foreach (RailExam.Model.Item item in subItemList)
                    {
                        if (item.ItemIndex.ToString() == this.dropTestNo.SelectedValue)
                        {
                            //保存当前变化前的题号
                            this.hfTestNoBefore.Value = item.ItemIndex.ToString();
                            DataLoadForEditOnSubsidiary(item);
                            break;
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Example #8
0
        protected void itemsGrid_DeleteCommand(object sender, GridItemEventArgs e)
        {
            ItemBLL itemBLL = new ItemBLL();

            itemBLL.DeleteItem(int.Parse(e.Item["ItemId"].ToString()));
            itemsGrid.DataBind();
        }
        public void BindItem(bool search)
        {
            if (!search)
            {
                ddlItem.Items.Clear();
                ddlItem.Items.Add(new ListItem("Select", ""));

                if (ddlItemType.SelectedValue != string.Empty)
                {
                    DataTable dtItem = ItemBLL.GetItem(new Guid(ddlItemType.SelectedValue));
                    ddlItem.DataSource     = dtItem;
                    ddlItem.DataTextField  = "Description";
                    ddlItem.DataValueField = "ID";
                    ddlItem.DataBind();
                }
            }
            else
            {
                ddlSItem.Items.Clear();
                ddlSItem.Items.Add(new ListItem("Select", ""));

                if (ddlSItemType.SelectedValue != string.Empty)
                {
                    DataTable dtItem = ItemBLL.GetItem(new Guid(ddlSItemType.SelectedValue));
                    ddlSItem.DataSource     = dtItem;
                    ddlSItem.DataTextField  = "Description";
                    ddlSItem.DataValueField = "ID";
                    ddlSItem.DataBind();
                }
            }
        }
        public ActionResult CompleteOrder()
        {
            var myCart = getMyShoppingCart();

            User myUser = new UserBLL().getUserByEmail(User.Identity.Name);
            if(myUser == null)
                SetSessionMessage(View(), SESSIONMESSAGE.FAIL, "Something went wrong. Please try again");

            var myOrder = new Order();
            myOrder.User = myUser;
            myOrder.DateTime = DateTime.Now;
            myOrder.Items = new List<OrderLine>();

            var itemTransaction = new ItemBLL();
            foreach(var item in myCart.Items)
            {
                item.InStock--;
                itemTransaction.Update(item);

                var orderLine = new OrderLine()
                {
                    Amount = 1,
                    Discount = 0,
                    Item = item
                };
                myOrder.Items.Add(orderLine);
            }

            var updatedOrder = new OrderBLL().Insert(myOrder);
            if(updatedOrder == null)
                SetSessionMessage(View(), SESSIONMESSAGE.FAIL, "Something went wrong. The order is not registered");
            myCart.EmptyCart();
            return SetSessionMessage(RedirectToAction("ListAll", "DisplayItems", new { area = "Common" }), SESSIONMESSAGE.SUCCESS, "The order is registered");
        }
        protected void fvBookChapter_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
        {
            ItemBLL objBll = new ItemBLL();
            IList <RailExam.Model.Item> objList =
                objBll.GetItemsByBookChapterId(Convert.ToInt32(e.Keys["BookId"].ToString()), Convert.ToInt32(e.Keys["ChapterId"].ToString()), 0, 0);

            if (objList.Count > 0)
            {
                ClientScript.RegisterStartupScript(GetType(),
                                                   "jsSelectFirstNode",
                                                   @"var ret = window.showModalDialog('/RailExamBao/Book/ItemEnabled.aspx?BookID=" + e.Keys["BookId"] + @"&ChapterID=" + e.Keys["ChapterId"] + @"','','help:no; status:no;dialogWidth:300px;dialogHeight:120px;');
                     window.parent.tvBookChapterChangeCallBack.callback(" + e.Keys["ChapterId"] + @", 'Rebuild');                        
                    if(window.parent.tvBookChapter.get_nodes().get_length() > 0)
                    {
                        window.parent.tvBookChapter.get_nodes().getNode(0).select();
                    } ",
                                                   true);
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(),
                                                   "jsSelectFirstNode",
                                                   @"window.parent.tvBookChapterChangeCallBack.callback(" + e.Keys["ChapterId"] + @", 'Rebuild');                        
                    if(window.parent.tvBookChapter.get_nodes().get_length() > 0)
                    {
                        window.parent.tvBookChapter.get_nodes().getNode(0).select();
                    }",
                                                   true);
            }
        }
Example #12
0
 public CDMarzoAutoShopMethods()
 {
     customerinfobll = new CustomerInfoDAL();
     itembll         = new ItemDAL();
     orderinfobll    = new OrderInfoDAL();
     salesbll        = new SalesDAL();
 }
Example #13
0
        protected void btnInput_Click(object sender, EventArgs e)
        {
            BookBLL bookBLL = new BookBLL();

            for (int i = 0; i < gvBook.Rows.Count; i++)
            {
                bool bChecked = ((CheckBox)gvBook.Rows[i].FindControl("chSelect")).Checked;

                if (bChecked)
                {
                    ItemBLL objBll = new ItemBLL();
                    IList <RailExam.Model.Item> objItemList = objBll.GetItemsByBookBookId(Convert.ToInt32(gvBook.DataKeys[i].Value.ToString()));

                    foreach (RailExam.Model.Item item in objItemList)
                    {
                        item.StatusId = 2;
                        objBll.UpdateItem(item);
                    }
                    if (Directory.Exists(Server.MapPath("../Online/Book/" + gvBook.DataKeys[i].Value + "/")))
                    {
                        DeleteFile(Server.MapPath("../Online/Book/" + gvBook.DataKeys[i].Value + "/"));
                    }
                    bookBLL.DeleteBook(Convert.ToInt32(gvBook.DataKeys[i].Value.ToString()));
                }
            }
            BindGrid();
        }
Example #14
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            double purchase_price = Double.Parse(txt_purchase_price.Text);
            double sale_price     = Double.Parse(txt_sale_price.Text);

            item_props_object                = new ItemProps();
            item_props_object.Id             = Int32.Parse(txt_id.Text);
            item_props_object.Name           = txt_name.Text.ToUpper();
            item_props_object.Barcode        = txt_barcode.Text;
            item_props_object.Purchase_price = purchase_price;
            item_props_object.Sale_price     = sale_price;
            item_props_object.Manufacturer   = txt_manufacturer.Text.ToUpper();
            item_props_object.Supplier       = ddn_supplier.Text;
            item_props_object.Status         = Int32.Parse(ddn_status.Text);
            item_bll_object = new ItemBLL();
            bool status = item_bll_object.InsertBLL(item_props_object);

            if (status)
            {
                Response.Write("<script>alert('Item Inserted Successfully')</script>");
                get_last_id();
                show_all_items();
            }
            else
            {
                Response.Write("<script>alert('Item Insertion Failed ')</script>");
            }
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hfChapterID.Value = Request.QueryString["id"];

            if (fvBookChapter.CurrentMode == FormViewMode.Insert)
            {
                if (hfInsert.Value == "-1")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfParentID")).Value = Request.QueryString["ParentID"];
                    ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value   = Request.QueryString["BookID"];
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfParentId")).Value = hfInsert.Value;
                    ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value   = Request.QueryString["BookID"];
                }
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }
            else if (fvBookChapter.CurrentMode == FormViewMode.Edit)
            {
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }

            if (!IsPostBack)
            {
                BindGrid();
            }

            string strRefreshGrid = Request.Form.Get("RefreshGrid");

            if (strRefreshGrid != null & strRefreshGrid != "")
            {
                fvBookChapter.DataBind();
                BindGrid();
            }

            string strRefresh = Request.Form.Get("Refresh");

            if (strRefresh != null & strRefresh != "")
            {
                ItemBLL objItemBll = new ItemBLL();
                objItemBll.DeleteItem(Convert.ToInt32(strRefresh));
                BindGrid();
            }
        }
Example #16
0
        // GET: Item/Create
        public ActionResult Create()
        {
            ItemBLL defItem = new ItemBLL();

            defItem.ItemID = 0;
            ViewBag.Users  = GetUserItems();
            return(View(defItem));
        }
Example #17
0
        public void get_last_id()
        {
            item_bll_object = new ItemBLL();
            int last_id = item_bll_object.GET_LAST_ID_BLL();

            last_id     = last_id + 1;
            txt_id.Text = last_id.ToString();
        }
Example #18
0
        protected void btnAll_Click(object sender, EventArgs e)
        {
            ItemBLL objBll = new ItemBLL();

            objBll.UpdateItemEnabled(Convert.ToInt32(ViewState["BookID"].ToString()),
                                     Convert.ToInt32(ViewState["ChapterID"].ToString()), 2);
            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string strItemTypeID = Request.QueryString.Get("itemTypeID");

            if (strItemTypeID == null)
            {
                strItemTypeID    = "1";
                hfItemType.Value = "1";
            }
            else
            {
                hfItemType.Value = strItemTypeID;
            }
            ItemBLL objItemBll = new ItemBLL();

            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = null;

            int postID = Convert.ToInt32(Request.QueryString.Get("PostID"));
            int orgID  = Convert.ToInt32(Request.QueryString.Get("OrgID"));
            int leader = Convert.ToInt32(Request.QueryString.Get("Leader"));
            int techID = Convert.ToInt32(Request.QueryString.Get("Tech"));

            bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0);

            if (bookList.Count > 0)
            {
                TreeViewNode tvn = null;

                foreach (RailExam.Model.Book book in bookList)
                {
                    tvn       = new TreeViewNode();
                    tvn.ID    = book.bookId.ToString();
                    tvn.Value = book.bookId.ToString();

                    int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID));
                    if (n > 0)
                    {
                        tvn.Text = book.bookName + "£¨" + n + "Ì⣩";
                    }
                    else
                    {
                        tvn.Text = book.bookName;
                    }

                    tvn.ToolTip = book.bookName;
                    tvn.Attributes.Add("isBook", "true");
                    tvn.ImageUrl = "/RailExamBao/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif";

                    tvn.ShowCheckBox = true;

                    tvn.ContentCallbackUrl = "/RailExamBao/Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=2&id=" +
                                             book.bookId;

                    tvBookChapter.Nodes.Add(tvn);
                }
            }
        }
Example #20
0
        public void show_all_items()
        {
            item_bll_object = new ItemBLL();
            DataTable ds = new DataTable();

            ds = item_bll_object.ALL_ITEMS_BLL();
            items_table.DataSource = ds;
            items_table.DataBind();
        }
Example #21
0
        private void DeleteData(int nBookChapterUpdateID)
        {
            BookUpdateBLL BookChapterUpdateBLL = new BookUpdateBLL();
            ItemBLL       objItemBll           = new ItemBLL();

            objItemBll.DeleteItemByChapterID(nBookChapterUpdateID, "");
            BookChapterUpdateBLL.DeleteBookUpdate(nBookChapterUpdateID);
            BindGrid();
        }
Example #22
0
        public static List <string> GetIems(string prefixText)
        {
            List <string> items = new List <string>();

            if (ItemType != null)
            {
                items = ItemBLL.GetItemCodes(ItemType, prefixText);
            }
            return(items);
        }
Example #23
0
        // <summary>
        // 发布教材
        // </summary>
        // <param name="strID"></param>
        //private void GetIndex(string strID)
        //{
        //    string  strItem;

        //    BookBLL objBll = new BookBLL();
        //    RailExam.Model.Book objBook = objBll.GetBook(Convert.ToInt32(strID));

        //    string strBookName = objBook.bookName;
        //    string strBookUrl = objBook.url;

        //    if (strBookUrl == "" || objBook.url == null)
        //    {
        //        strItem = "var TREE_ITEMS = [ ['" + strBookName + "', 'empty.htm',";
        //    }
        //    else
        //    {
        //        strItem = "var TREE_ITEMS = [ ['" + strBookName + "', 'cover.htm',";
        //    }


        //    BookChapterBLL objBookChapterBll = new BookChapterBLL();
        //    IList<RailExam.Model.BookChapter> objBookChapter = objBookChapterBll.GetBookChapterByBookID(Convert.ToInt32(strID));

        //    foreach (RailExam.Model.BookChapter chapter in objBookChapter)
        //    {
        //        if(chapter.ParentId == 0)
        //        {
        //            if (chapter.Url == "" || chapter.Url == null)
        //            {
        //                strItem += "['" + chapter.ChapterName + "', 'empty.htm',";
        //            }
        //            else
        //            {
        //                strItem += "['" + chapter.ChapterName + "', '" + chapter.ChapterId + ".htm',";
        //            }

        //            strItem = Get(chapter.ChapterId, strItem);
        //        }
        //    }

        //    strItem += "]];";

        //    string strPath = "../Online/Book/" + strID + "/tree_items.js";
        //    File.Delete(Server.MapPath(strPath));
        //    File.AppendAllText(Server.MapPath(strPath), strItem, System.Text.Encoding.UTF8);

        //    string[] strIndex = File.ReadAllLines(Server.MapPath("../Online/Book/" + strID + "/index.html"), System.Text.Encoding.Default);

        //    for (int i = 0; i < strIndex.Length; i++)
        //    {
        //        if (strIndex[i].IndexOf("<title>") != -1)
        //        {
        //            strIndex[i] = "\t<title> " + strBookName + " </title>";
        //        }
        //    }

        //    File.WriteAllLines(Server.MapPath("../Online/Book/" + strID + "/index.html"), strIndex, System.Text.Encoding.UTF8);

        //    ViewState["NowID"] = strID;
        //    Response.Write("<script>var re = window.open('Book/"+strID+"/index.html','index','top=0,left=0,width='+(window.screen.width-10)+',height='+(window.screen.height-65)+',resizable=yes,status=no');re.focus();</script>");
        //}

        //private string Get(int strParentID, string strItem)
        //{
        //    BookChapterBLL objBookChapterBll = new BookChapterBLL();
        //    IList<RailExam.Model.BookChapter> objBookChapter = objBookChapterBll.GetBookChapterByParentID(strParentID);

        //    foreach (RailExam.Model.BookChapter chapter in objBookChapter)
        //    {
        //        if (chapter.Url == "" || chapter.Url == null)
        //        {
        //            strItem += "['" + chapter.ChapterName + "', 'empty.htm'";
        //        }
        //        else
        //        {
        //            strItem += "['" + chapter.ChapterName + "', '" + chapter.ChapterId + ".htm'";
        //        }

        //        strItem = Get(chapter.ChapterId, strItem);
        //    }

        //    strItem += "],";

        //    return strItem;
        //}

        // <summary>
        // 复写Render方法
        // </summary>
        // <param name="writer">书写器</param>
        //protected override void Render(HtmlTextWriter writer)
        //{
        //    base.Render(writer);

        //    if ((string)ViewState["NowID"] != "false")
        //    {
        //        ViewState["NowCheck"] = "false";
        //        writer.Write("<script>var re = window.open('../Online/Book/" + ViewState["NowID"].ToString() + "/index.html','index','top=0,left=0,width='+(window.screen.width-10)+',height='+(window.screen.height-65)+',resizable=yes,status=no');re.focus();</script>");
        //    }
        //}
        #endregion

        private void DelBook(string strID)
        {
            ItemBLL objItemBll = new ItemBLL();

            objItemBll.UpdateItemEnabled(Convert.ToInt32(strID), 0, 2);

            BookBLL objBll = new BookBLL();

            objBll.DeleteBook(Convert.ToInt32(strID));
        }
Example #24
0
        private void delete_btn_Click(object sender, RoutedEventArgs e)
        {
            int  n;
            bool isNumeric = int.TryParse(this.price.Text, out n);
            int  n2;
            bool isNumeric2 = int.TryParse(this.size.Text, out n2);

            if (string.IsNullOrWhiteSpace(this.pid.Text))
            {
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    pid.Background = Brushes.Red;
                }
                MessageBox.Show("Validate");
                return;
            }
            if ((isNumeric == false) || string.IsNullOrWhiteSpace(this.category.Text) || (isNumeric2 == false) || string.IsNullOrWhiteSpace(this.color.Text) || string.IsNullOrWhiteSpace(this.brand.Text) || string.IsNullOrWhiteSpace(this.entryDate.Text))
            {
                search_btn_Click(sender, e);
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    return;
                }
            }
            ItemBO item = new ItemBO();

            item.Pid = this.pid.Text;

            ItemBLL itenbl = new ItemBLL();
            int     rv     = itenbl.deleteItem(item);

            if (rv == 0)
            {
                MessageBox.Show("Deleted");
                this.pid.Text       = null;
                this.price.Text     = null;
                this.category.Text  = null;
                this.size.Text      = null;
                this.color.Text     = null;
                this.brand.Text     = null;
                this.entryDate.Text = null;
                //this.quantity.Text = null;
            }
            else if (rv == 3)
            {
                MessageBox.Show("Product ID do not Exist");
                this.pid.Text = null;
            }
            else
            {
                MessageBox.Show("Error");
            }
            this.pid.IsEnabled = true;
        }
        private int GetMaxNumByItemType(int itemTypeID)
        {
            int     num        = 0;
            ItemBLL objItemBll = new ItemBLL();

            foreach (DictionaryEntry entry in _htBook)
            {
                num = num + objItemBll.GetItemsByBookID(Convert.ToInt32(entry.Key), itemTypeID);
            }

            return(num);
        }
        public void FixedAssetdItem()
        {
            DataTable dtItem = ItemBLL.GetItem(new Guid("45874e2b-da53-46c9-a5ae-1638d540f682"));// temporary

            ddlItem.DataSource     = dtItem;
            ddlItem.DataTextField  = "Description";
            ddlItem.DataValueField = "ID";
            ddlItem.DataBind();

            ddlSItem.DataTextField  = "Description";
            ddlSItem.DataValueField = "ID";
            ddlSItem.DataBind();
        }
 // GET: Common/Item/Details/5
 public ActionResult Details(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Item item = new ItemBLL().GetById(id);
     if (item == null)
     {
         return HttpNotFound();
     }
     return View(item);
 }
 // GET: Common/Item
 public ActionResult ListAll()
 {
     List<Item> domainItems = new List<Item>();
     try {
         domainItems = new ItemBLL().GetList();
         return View(domainItems.AsEnumerable());
     }
     catch (Exception)
     {
         return SetSessionMessage(View(domainItems), SESSIONMESSAGE.FAIL,
             "We could not retrieve products from the database");
     }
 }
        protected void btnTrue_Click(object sender, EventArgs e)
        {
            string[] itemvalue = hfItemID.Value.Split('|');

            ItemBLL objItemBll = new ItemBLL();

            for (int i = 0; i < itemvalue.Length; i++)
            {
                objItemBll.UpdateItemEnabled(Convert.ToInt32(itemvalue[i]), 1);
            }

            itemsGrid.DataBind();
        }
Example #30
0
        private void add_btn_Click(object sender, RoutedEventArgs e)
        {
            int  n;
            bool isNumeric = int.TryParse(this.price.Text, out n);

            if (string.IsNullOrWhiteSpace(this.pid.Text) || (isNumeric == false))
            {
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    pid.Background = Brushes.Red;
                }
                if (isNumeric == false)
                {
                    price.Background = Brushes.Red;
                }
                MessageBox.Show("Validate");

                return;
            }
            ItemBO item = new ItemBO();

            item.Pid      = this.pid.Text;
            item.Price    = Convert.ToInt32(this.price.Text);
            item.Category = this.category.Text;
            item.Size     = Convert.ToInt32(this.size.Text);
            item.Color    = this.color.Text;
            item.Brand    = this.brand.Text;
            item.Date     = this.entryDate.Text;
            item.Quantity = 1;
            //MessageBox.Show(item.Pid + " " + item.Price + " " + item.Category + " " + item.Size + " " + item.Color + " " + item.Brand + " " + item.Date);

            ItemBLL itenbl = new ItemBLL();
            int     rv     = itenbl.addItem(item);

            if (rv == 0)
            {
                MessageBox.Show("INSERTED");
                this.pid.Text   = null;
                this.price.Text = null;
                //this.quantity.Text = null;
            }
            else if (rv == 3)
            {
                MessageBox.Show("Product ID Already Exist");
                this.pid.Text = null;
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
Example #31
0
        // Return true or false for ownership
        bool IsThisMine(ContextBLL ctx, ItemBLL mine)
        {
            if (User.IsInRole(Constants.AdminRoleName))
            {
                return(true);
            }
            UserBLL me = ctx.User_FindByUserName(User.Identity.Name);

            if (me == null)
            {
                return(false);
            }
            return(me.UserID == mine.UserID);
        }
Example #32
0
 //Get Selected Item For updation
 public void GetSelectedItem(ItemBLL it)
 {
     try
     {
         itemBLLObj.BLLGetSelectedItem(it);
         txtItemName.Text        = itemBLLObj.itemName;
         txtItemDescription.Text = itemBLLObj.itemDescription;
         cmbCity.SelectedValue   = Convert.ToString(itemBLLObj.cityId);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void search_btn_Click(object sender, RoutedEventArgs e)
        {
            string from = this.from.Text;
            string to   = this.to.Text;

            if (DateTime.Parse(to) < DateTime.Parse(from))
            {
                MessageBox.Show("Invalid Dates");
                return;
            }

            ItemBLL ib = new ItemBLL();
            List <ServiceForUpdateBO> ls = ib.getUserServiceReportBW(from, to);

            this.dataGrid.ItemsSource = ls;
        }
Example #34
0
        public void removeItem()
        {
            Console.Clear();
            System.Console.WriteLine("Remove Item:- \n\n");

            System.Console.Write("Enter Item ID: ");
            int    id;
            String c = System.Console.ReadLine();

            if (c.Length != 0)
            {
                id = int.Parse(c);
            }
            else
            {
                id = 0;
            }

            ItemBLL itemB = new ItemBLL();
            ItemBO  o     = itemB.find(id);


            if (o.Itemid != 0)
            {
                System.Console.Write("Confirm removal? (Y/N): ");
                c = System.Console.ReadLine();

                if (c.Length != 0 && (c[0] == 'Y' || c[0] == 'y'))
                {
                    itemB.remove(o);
                    Console.Clear();
                    System.Console.WriteLine("\n\n\n\n\n\n ***Removal Successful***");
                    System.Threading.Thread.Sleep(1000);
                }
                else
                {
                    Console.Clear();
                    System.Console.WriteLine("\n\n\n\n\n\n ***Removal NOT Successful***");
                    System.Threading.Thread.Sleep(1000);
                }
            }
            else
            {
                System.Console.WriteLine("\nError! Item NOT found");
                System.Threading.Thread.Sleep(1000);
            }
        }