Exemplo n.º 1
0
        /// <summary>
        /// 重新加载列表
        /// </summary>
        private void ReloadNewList()
        {
            ProductListNew.Clear();
            foreach (var item in ProductList.Skip(PosLine.ListCountProduct * (CurrentPage - 1)).Take(PosLine.ListCountProduct))
            {
                item.IsNavigated  = false;
                item.NavigateMode = 0;
                ProductListNew.Add(item);
            }

            if (ProductListNew.Count > 0)
            {
                CurrentIndex = 0;
                ProductListNew[CurrentIndex].IsNavigated  = true;
                ProductListNew[CurrentIndex].NavigateMode = 0;
            }
            CalcAndResetPage();
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> AddProduct([FromBody] List <ProductListNew> value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            using (var connection = new SqlConnection(sqlConnectionString))
            {
                connection.Open();
                for (int i = 0; i < value.Count; i++)
                {
                    var p = new ProductListNew
                    {
                        VarietyName  = value[i].VarietyName,
                        CatTypeId    = value[i].CatTypeId,
                        Unit         = value[i].Unit,
                        IsLot        = value[i].IsLot,
                        IsActive     = true,
                        GName        = value[i].GName,
                        AddedOn      = DateTime.Now,
                        AddedBy      = 1,
                        speci        = value[i].speci,
                        GSreservre   = value[i].GSreservre,
                        AdminComment = value[i].AdminComment,
                        ProductDesc  = value[i].ProductDesc,
                    };
                    p.Id = connection.Query <int>(@"insert ProductMaster_New(VarietyName,CatTypeId,Unit,IsLot,IsActive,GName,AddedOn,
                        AddedBy,speci,GSreservre,AdminComment,ProductDesc) values (@VarietyName,@CatTypeId,@Unit,@IsLot,@IsActive,@GName,@AddedOn,
                        @AddedBy,@speci,@GSreservre,@AdminComment,@ProductDesc) select cast(scope_identity() as int)", p).First();
                }
                //var userExist = connection.Query<Product>("Select * from ProductMaster where Category_Id = @Category_Id and Product_Name =@Product_Name", new { Category_Id = value.Category_Id, Product_Name=value.Product_Name }).FirstOrDefault();
                //if (userExist == null)
                //{

                return(Json(new { Message = "Record Inserted Successfully" }));


                //}
                //else
                //{
                //    throw new ProcessException("Username already exists");
                //}
            }
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> AddSingleProduct([FromBody] ProductListNew value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            using (var connection = new SqlConnection(sqlConnectionString))
            {
                connection.Open();
                var p = new ProductListNew
                {
                    VarietyName  = value.VarietyName,
                    CatTypeId    = value.CatTypeId,
                    Unit         = value.Unit,
                    IsLot        = value.IsLot,
                    IsActive     = true,
                    GName        = value.GName,
                    AddedOn      = DateTime.Now,
                    AddedBy      = 1,
                    speci        = value.speci,
                    GSreservre   = value.GSreservre,
                    AdminComment = value.AdminComment,
                    ProductDesc  = value.ProductDesc,
                };
                p.Id = connection.Query <int>(@"insert ProductMaster_New(VarietyName,CatTypeId,Unit,IsLot,IsActive,GName,AddedOn,
                        AddedBy,speci,GSreservre,AdminComment,ProductDesc) values (@VarietyName,@CatTypeId,@Unit,@IsLot,@IsActive,@GName,@AddedOn,
                        @AddedBy,@speci,@GSreservre,@AdminComment,@ProductDesc) select cast(scope_identity() as int)", p).First();

                return(Json(new { Message = "Record Inserted Successfully" }));


                //}
                //else
                //{
                //    throw new ProcessException("Username already exists");
                //}
            }
        }