Esempio n. 1
0
        public new void Add(T item)
        {
            var i = Count;

            base.Add(item);
            ItemAdd?.Invoke(item, i);
        }
Esempio n. 2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ItemAdd MasterEntity = (ItemAdd)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_ItemAdd WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Esempio n. 3
0
        public new void Insert(int index, T item)
        {
            var i = Count;

            base.Insert(index, item);
            ItemAdd?.Invoke(item, i);
        }
Esempio n. 4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ItemAdd MasterEntity = (ItemAdd)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_ItemAdd(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("Name" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Name) + ",");
                MasterField.Append("FiledName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FiledName) + ",");
                MasterField.Append("Value" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Value) + ",");
                MasterField.Append("DRemark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DRemark) + ",");
                MasterField.Append("FiledSetID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FiledSetID) + ",");
                MasterField.Append("FormID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormID) + ",");
                MasterField.Append("FormAID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormAID) + ",");
                MasterField.Append("FormBID" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormBID) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, int Flag, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Item      entity = (Item)p_BE;
                string    sql    = "SELECT ItemCode FROM Data_Item WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                DataTable dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("编码已存在,请重新生成");
                }

                ItemCtl control = new ItemCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_Item, sqlTrans);
                control.AddNew(entity);

                ItemColorDtsRule rule2 = new ItemColorDtsRule();
                rule2.RSave(entity, p_BE2, sqlTrans);

                ItemAddRule ruleItemAdd = new ItemAddRule();
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    ItemAdd entityDts = (ItemAdd)p_BE3[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemAdd.RAdd(entityDts, sqlTrans);

                    ruleItemAdd.UpdateFiledSet(entity.ID, entityDts.FiledSetID, entityDts.Value, sqlTrans);
                }

                ItemPicRule ruleItemPic = new ItemPicRule();
                for (int i = 0; i < p_BE4.Length; i++)
                {
                    ItemPic entityDts = (ItemPic)p_BE4[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemPic.RAdd(entityDts, sqlTrans);
                }

                ItemCodeFacDtsRule ruleItemCodeFac = new ItemCodeFacDtsRule();
                for (int i = 0; i < p_BE5.Length; i++)
                {
                    ItemCodeFacDts entityDts = (ItemCodeFacDts)p_BE5[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruleItemCodeFac.RAdd(entityDts, sqlTrans);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Esempio n. 6
0
        // Add item
        public ItemBase ItemAdd(ItemAdd newItem)
        {
            if (newItem == null)
            {
                return(null);
            }

            // Check for matching user
            var userId = ds.Users.SingleOrDefault(i => i.UserId == newItem.SellerId);

            if (userId == null)
            {
                return(null);
            }

            // Set id
            int?newId = ds.Items.Select(m => (int?)m.ItemId).Max() + 1;

            if (newId == null)
            {
                newId = 1;
            }

            // Add item
            Item addedItem = Mapper.Map <Item>(newItem);

            addedItem.ItemId = (int)newId;

            // Course details
            var course = new Course()
            {
                Name    = newItem.CourseName,
                Program = newItem.CourseProgram
            };

            addedItem.Course = course;

            // Book details
            if (newItem.Type == "Book")
            {
                var book = new Book()
                {
                    Title     = newItem.BookTitle,
                    Author    = newItem.BookAuthor,
                    Publisher = newItem.BookPublisher,
                    Year      = newItem.BookYear
                };

                addedItem.Book = book;
            }

            ds.Items.Add(addedItem);
            ds.SaveChanges();

            return(Mapper.Map <ItemBase>(addedItem));
        }
Esempio n. 7
0
        private static Dictionary <string, string> ConvertToDictionaryUpdate(ItemAdd item)
        {
            var dict = new Dictionary <string, string>
            {
                { "project", item.Project },
                { "description", item.Description }
            };

            return(dict);
        }
Esempio n. 8
0
        private static Dictionary <string, string> ConvertToDictionary(ItemAdd item)
        {
            var dict = new Dictionary <string, string>
            {
                { "barcode", item.BarCode },
                { "checkInUser", item.CheckInUser },
                { "checkOutUser", item.CheckOutUser },
                { "project", item.Project },
                { "description", item.Description }
            };

            return(dict);
        }
Esempio n. 9
0
 public /*AllproductsPage*/ ProductPage AddingName(ItemAdd item)
 {
     ProductNameInput.SendKeys(item.selectName);
     //CategoryIdInput.SendKeys(item.selectCategory);
     //SupplierIdInput.SendKeys(item.selectSupplier);
     //UnitPriceInput.SendKeys(item.selectPrice);
     //QuantityPerUnitInput.SendKeys(item.selectQuantity);
     //UnitsInStockInput.SendKeys(item.selectInstock);
     //UnitsOnOrderInput.SendKeys(item.selectOnorder);
     //ReorderLevelInput.SendKeys(item.selectReorder);
     //new Actions(driver).SendKeys(Keys.Enter).Build().Perform();
     //return new AllproductsPage(driver);
     return(this);
 }
Esempio n. 10
0
        /// <summary>
        /// 检验字段值是否已存在
        /// </summary>
        /// <param name="p_TableName">表名</param>
        /// <param name="p_FieldName">字段名</param>
        /// <param name="p_FieldValue">字段值</param>
        /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param>
        /// <param name="p_KeyValue">主键值</param>
        /// <param name="p_sqlTrans"></param>
        /// <returns></returns>
        private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans)
        {
            ItemAdd   entity = (ItemAdd)p_BE;
            bool      ret    = false;
            string    sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, ItemAdd.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.MainID);
            DataTable dt     = p_sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                ret = true;
            }

            return(ret);
        }
Esempio n. 11
0
        public string SaveItem(ItemAdd aItem)
        {
            if (aItemGateway.IsItemNameExist(aItem.ItemName))
            {
                return("Product Name Already Exists.");
            }
            int rowaffected = aItemGateway.SaveItem(aItem);

            if (rowaffected > 0)
            {
                return("Save Successfully.");
            }
            return("Save Failed.");
        }
Esempio n. 12
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ItemAdd MasterEntity = (ItemAdd)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_ItemAdd SET ");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" Name=" + SysString.ToDBString(MasterEntity.Name) + ",");
                UpdateBuilder.Append(" FiledName=" + SysString.ToDBString(MasterEntity.FiledName) + ",");
                UpdateBuilder.Append(" Value=" + SysString.ToDBString(MasterEntity.Value) + ",");
                UpdateBuilder.Append(" DRemark=" + SysString.ToDBString(MasterEntity.DRemark) + ",");
                UpdateBuilder.Append(" FiledSetID=" + SysString.ToDBString(MasterEntity.FiledSetID) + ",");
                UpdateBuilder.Append(" FormID=" + SysString.ToDBString(MasterEntity.FormID) + ",");
                UpdateBuilder.Append(" FormAID=" + SysString.ToDBString(MasterEntity.FormAID) + ",");
                UpdateBuilder.Append(" FormBID=" + SysString.ToDBString(MasterEntity.FormBID));

                UpdateBuilder.Append(" WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
        private void itemSaveBtn_Click(object sender, EventArgs e)
        {
            ItemAdd aItem = new ItemAdd();

            aItem.CategoryId   = Convert.ToInt32(itemCategoryComboBox.SelectedValue);
            aItem.CompanyId    = Convert.ToInt32(itemCompanyNameComboBox.SelectedValue);
            aItem.ItemName     = itemNameTextBox.Text;
            aItem.ReorderLevel = Convert.ToInt32(reorderTextBox.Text);
            if (itemSaveBtn.Text == "Save")
            {
                string message = aItemManager.SaveItem(aItem);
                MessageBox.Show(message);
            }
            ItemClear();
        }
Esempio n. 14
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ItemAdd    entity  = (ItemAdd)p_BE;
         ItemAddCtl control = new ItemAddCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
        public int SaveItem(ItemAdd aItem)
        {
            connection.Open();
            query = "INSERT INTO Items (CategoryId,CompanyId,ItemName,ReorderLevel) VALUES (@CategoryId ,@CompanyId ,@ItemName,@ReorderLevel)";
            cmd   = new SqlCommand(query, connection);
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("CategoryId", aItem.CategoryId);
            cmd.Parameters.AddWithValue("CompanyId", aItem.CompanyId);
            cmd.Parameters.AddWithValue("ItemName", aItem.ItemName);
            cmd.Parameters.AddWithValue("ReorderLevel", aItem.ReorderLevel);
            //cmd.Parameters.AddWithValue("CreatedBy", aItem.CreatedBy);
            //cmd.Parameters.AddWithValue(DateTime.Parse("CreationDate", aItem.CreatedBy));
            //cmd.Parameters.Add
            int rowAffected = cmd.ExecuteNonQuery();

            connection.Close();
            return(rowAffected);
        }
Esempio n. 16
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ItemAdd    entity  = (ItemAdd)p_BE;
         ItemAddCtl control = new ItemAddCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_ItemAdd,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Esempio n. 17
0
        public async Task <bool> UpdateItemAsync(Item item)
        {
            //Add Item update to DB
            //var _item = items.Where((Item arg) => arg._id == item._id).FirstOrDefault();
            //items.Remove(_item);
            //items.Add(item);
            server = props.GetPropertyValue("Server");
            GetRestURL(server);
            ItemAdd addItem = item;
            Dictionary <string, string> dict = ConvertToDictionaryUpdate(addItem);
            var client = new HttpClient();
            var req    = new HttpRequestMessage(HttpMethod.Put, RestUrlHead + "/" + item._id)
            {
                Content = new FormUrlEncodedContent(dict)
            };
            var res = await client.SendAsync(req);

            return(await Task.FromResult(true));
        }
Esempio n. 18
0
    //Adds items depending if there are slots available and
    public void AddItem(TheInventoryItem item)
    {
        if (myItems.Count < SLOTS)
        {
            Collider collider = (item as MonoBehaviour).GetComponent <Collider>();

            if (collider.enabled)
            {
                //Checks to see if collider enabled worked properly since we are using triggers.
                Debug.Log("collider check");
                collider.enabled = false;

                myItems.Add(item);

                item.OnPickup();

                ItemAdd?.Invoke(this, new InventoryEventArgs(item));
            }
        }
    }
Esempio n. 19
0
        public async Task <bool> AddItemAsync(Item item)
        {
            ItemAdd addItem = item;

            server = props.GetPropertyValue("Server");
            GetRestURL(server);

            Dictionary <string, string> dict = ConvertToDictionary(addItem);
            var client = new HttpClient();
            var req    = new HttpRequestMessage(HttpMethod.Post, RestUrlHead)
            {
                Content = new FormUrlEncodedContent(dict)
            };
            var res = await client.SendAsync(req);

            // Console.WriteLine("JFG-additemasync - mockdatastore");
            var items = GetItemsAsync();


            return(await Task.FromResult(true));
        }
Esempio n. 20
0
        public IHttpActionResult Post([FromBody] ItemAdd newItem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            // Attempt to add item
            var addedItem = m.ItemAdd(newItem);

            if (addedItem == null)
            {
                return(BadRequest("Cannot add the object"));
            }
            else
            {
                // HTTP 201 with the new object in the entity body
                var uri = Url.Link("DefaultApi", new { id = addedItem.ItemId });
                return(Created(uri, addedItem));
            }
        }
Esempio n. 21
0
 /// <summary>
 /// リストビューにイベントを追加します
 /// </summary>
 /// <param name="item">追加するListViewItem</param>
 public void AddItem(ListViewItem item)
 {
     this.BeginUpdate();
     if (this.isSetMaxLength)
     {
         int c = this.Items.Count;
         if (c >= this.maxLength)
         {
             Items.RemoveAt(c - 1);
         }
         Items.Insert(0, item);
     }
     else
     {
         Items.Add(item);
     }
     this.EndUpdate();
     if (ItemAdd != null)
     {
         ItemAdd.Invoke(this, new ItemsAddedArgs(item));
     }
 }
Esempio n. 22
0
        private ItemAdd[] GetItemAdd()
        {
            int index = 0;

            for (int i = 0; i < gridView6.RowCount; i++)
            {
                if (SysConvert.ToString(gridView6.GetRowCellValue(i, "Name")) != "")
                {
                    index++;
                }
            }
            ItemAdd[] entity = new ItemAdd[index];
            index = 0;
            for (int i = 0; i < gridView6.RowCount; i++)
            {
                if (SysConvert.ToString(gridView6.GetRowCellValue(i, "Name")) != "")
                {
                    entity[index]        = new ItemAdd();
                    entity[index].MainID = SysConvert.ToInt32(gridView6.GetRowCellValue(i, "MainID"));
                    entity[index].Seq    = SysConvert.ToInt32(gridView6.GetRowCellValue(i, "Seq"));
                    entity[index].SelectByID();

                    entity[index].FiledSetID = SysConvert.ToInt32(gridView6.GetRowCellValue(i, "FiledSetID"));
                    entity[index].Name       = SysConvert.ToString(gridView6.GetRowCellValue(i, "Name"));
                    entity[index].FiledName  = SysConvert.ToString(gridView6.GetRowCellValue(i, "FiledName"));
                    entity[index].Value      = SysConvert.ToString(gridView6.GetRowCellValue(i, "Value"));
                    entity[index].DRemark    = SysConvert.ToString(gridView6.GetRowCellValue(i, "DRemark"));
                    entity[index].FormID     = this.FormID;
                    entity[index].FormAID    = this.FormListAID;
                    entity[index].FormBID    = this.FormListBID;
                    index++;
                }
            }

            return(entity);
        }
Esempio n. 23
0
        public JsonResult AddItems(ItemAdd goods)
        {
            string       errormsg   = null;
            tbClientUser clientuser = GetUser("UserInfo");

            if (string.IsNullOrEmpty(goods.Desc) && goods.Desc.Length > 5)
            {
                return(Json(new { ErrorMsg = "商品描述字数应大于5小于20000!" }));
            }
            string itemid = goodsinfo.addgoods(clientuser.UserShops[0].SessionKey, goods, out errormsg);

            if (itemid == null)
            {
                return(Json(new { ErrorMsg = errormsg }));
            }
            string[] path = goods.ChildPicPath.Split('^');
            if (path == null)
            {
                return(Json(new { ErrorMsg = "" }));
            }
            ItemJointImg itemjoin;

            for (int i = 0; i < path.Count(); i++)
            {
                if (string.IsNullOrEmpty(path[i]) && i.ToString().Length > 5)
                {
                    string str = "http://img03.tbsandbox.com/imgextra/";
                    itemjoin          = new ItemJointImg();
                    itemjoin.NumIid   = long.Parse(itemid);
                    itemjoin.PicPath  = path[i].ToString().Substring(str.Length - 1, path[i].ToString().Length - str.Length + 1);
                    itemjoin.Position = long.Parse(path[i + 1]);
                    sgi.ImgItemJoint(clientuser.UserShops[0].SessionKey, itemjoin, out errormsg);
                }
            }
            return(Json(new { ErrorMsg = errormsg }));
        }
Esempio n. 24
0
 public void Add(PerformanceListItem newcontrol)
 {
     List.Add(newcontrol);
     ItemAdd?.Invoke(newcontrol);
 }
Esempio n. 25
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Vendor entity = (Vendor)p_BE;
                this.RAdd(entity, sqlTrans);

                for (int i = 0; i < p_BE2.Length; i++)
                {
                    VendorContactRule rule = new VendorContactRule();
                    VendorContact     entityVendorContact = (VendorContact)p_BE2[i];
                    entityVendorContact.MainID = entity.ID;
                    entityVendorContact.Seq    = i + 1;
                    rule.RAdd(entityVendorContact, sqlTrans);
                }
                //新增客户归属业务员
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    VendorSaleOPRule rule = new VendorSaleOPRule();
                    VendorSaleOP     entityVendorSaleOP = (VendorSaleOP)p_BE3[i];
                    entityVendorSaleOP.MainID = entity.ID;
                    entityVendorSaleOP.Seq    = i + 1;
                    rule.RAdd(entityVendorSaleOP, sqlTrans);
                }

                for (int i = 0; i < p_BE4.Length; i++)
                {
                    VendorAddressRule rule = new VendorAddressRule();
                    VendorAddress     entityVendorAddress = (VendorAddress)p_BE4[i];
                    entityVendorAddress.MainID = entity.ID;
                    entityVendorAddress.Seq    = i + 1;
                    rule.RAdd(entityVendorAddress, sqlTrans);
                }

                for (int i = 0; i < p_BE5.Length; i++)
                {
                    VendorNewsRule rule             = new VendorNewsRule();
                    VendorNews     entityVendorNews = (VendorNews)p_BE5[i];
                    entityVendorNews.MainID = entity.ID;
                    entityVendorNews.Seq    = i + 1;
                    rule.RAdd(entityVendorNews, sqlTrans);
                }

                for (int i = 0; i < p_BE7.Length; i++)
                {
                    ItemAddRule rule          = new ItemAddRule();
                    ItemAdd     entityItemAdd = (ItemAdd)p_BE7[i];
                    entityItemAdd.MainID = entity.ID;
                    entityItemAdd.Seq    = i + 1;
                    rule.RAdd(entityItemAdd, sqlTrans);
                    rule.UpdateFiledSet(entity.ID, entityItemAdd.FiledSetID, entityItemAdd.Value, sqlTrans);
                }

                for (int i = 0; i < p_BE8.Length; i++)
                {
                    VendorInvoiceDtsRule rule = new VendorInvoiceDtsRule();
                    VendorInvoiceDts     entityItemInvoice = (VendorInvoiceDts)p_BE8[i];
                    entityItemInvoice.MainID = entity.ID;
                    entityItemInvoice.Seq    = i + 1;
                    rule.RAdd(entityItemInvoice, sqlTrans);
                }


                VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule();
                vendortyperule.RSave(p_BE, p_BE6, sqlTrans);
                //FormNoControlRule fnrule = new FormNoControlRule();
                //fnrule.RAddSort("Data_Vendor", "VendorID", entity.VendorTypeID, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Esempio n. 26
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ItemAdd entity = (ItemAdd)p_BE;
 }
Esempio n. 27
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Vendor entity = (Vendor)p_BE;
                this.RUpdate(p_BE, sqlTrans);
                //VendorCtl control = new VendorCtl(sqlTrans);
                //control.Update(entity);
                string sql = "DELETE Data_VendorSaleOP WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorContact WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorAddress WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorNews WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE  Data_VendorInvoiceDts WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                if (p_BE7.Length > 0)
                {
                    sql  = "DELETE  Data_ItemAdd WHERE MainID=" + SysString.ToDBString(entity.ID);
                    sql += " AND ISNULL(FormID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormID);
                    sql += " AND ISNULL(FormAID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormAID);
                    sql += " AND ISNULL(FormBID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormBID);
                    sqlTrans.ExecuteNonQuery(sql);
                }
                //新增客户联系人
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    VendorContactRule rule = new VendorContactRule();
                    VendorContact     entityVendorContact = (VendorContact)p_BE2[i];
                    entityVendorContact.MainID = entity.ID;
                    entityVendorContact.Seq    = i + 1;
                    rule.RAdd(entityVendorContact, sqlTrans);
                }
                //新增客户归属业务员
                for (int i = 0; i < p_BE3.Length; i++)
                {
                    VendorSaleOPRule rule = new VendorSaleOPRule();
                    VendorSaleOP     entityVendorSaleOP = (VendorSaleOP)p_BE3[i];
                    entityVendorSaleOP.MainID = entity.ID;
                    entityVendorSaleOP.Seq    = i + 1;
                    rule.RAdd(entityVendorSaleOP, sqlTrans);
                }

                for (int i = 0; i < p_BE4.Length; i++)
                {
                    VendorAddressRule rule = new VendorAddressRule();
                    VendorAddress     entityVendorAddress = (VendorAddress)p_BE4[i];
                    entityVendorAddress.MainID = entity.ID;
                    entityVendorAddress.Seq    = i + 1;
                    rule.RAdd(entityVendorAddress, sqlTrans);
                }

                for (int i = 0; i < p_BE5.Length; i++)
                {
                    VendorNewsRule rule             = new VendorNewsRule();
                    VendorNews     entityVendorNews = (VendorNews)p_BE5[i];
                    entityVendorNews.MainID = entity.ID;
                    entityVendorNews.Seq    = i + 1;
                    rule.RAdd(entityVendorNews, sqlTrans);
                }

                for (int i = 0; i < p_BE7.Length; i++)
                {
                    ItemAddRule rule          = new ItemAddRule();
                    ItemAdd     entityItemAdd = (ItemAdd)p_BE7[i];
                    entityItemAdd.MainID = entity.ID;
                    entityItemAdd.Seq    = i + 1;
                    rule.RAdd(entityItemAdd, sqlTrans);
                    rule.UpdateFiledSet(entity.ID, entityItemAdd.FiledSetID, entityItemAdd.Value, sqlTrans);
                }

                for (int i = 0; i < p_BE8.Length; i++)
                {
                    VendorInvoiceDtsRule rule = new VendorInvoiceDtsRule();
                    VendorInvoiceDts     entityItemInvoice = (VendorInvoiceDts)p_BE8[i];
                    entityItemInvoice.MainID = entity.ID;
                    entityItemInvoice.Seq    = i + 1;
                    rule.RAdd(entityItemInvoice, sqlTrans);
                }

                VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule();
                vendortyperule.RSave(p_BE, p_BE6, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Esempio n. 28
0
 /// <summary>
 /// 添加商品
 /// </summary>
 /// <param name="token"></param>
 /// <param name="goods"></param>
 /// <param name="ErrorMsg"></param>
 /// <returns></returns>
 public string addgoods(string token, ItemAdd goods, out string ErrorMsg)
 {
     return(setgoods.AddGoods(token, goods, out ErrorMsg));
 }
 public static void OnItemAdd()
 {
     ItemAdd?.Invoke();
 }
Esempio n. 30
0
        public ActionResult ItemAdd(ItemsDTO input)
        {
            ItemAdd model = new ItemAdd();

            return(View(model));
        }