예제 #1
0
        /// <summary>
        /// 得到新增EquipmentDie
        /// </summary>
        public string GetEquipmentDie_AddSQL(EquipmentDie EquipmentDie)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [EquipmentDie](");
            strSql.Append("DieGuID,EquipmentGuID,DieType,ProductType,Life,Energy,PartName,PartID,ExteriorSize,Datum,DieSource,Aperture");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("'" + EquipmentDie.DieGuID + "',");
            strSql.Append("'" + EquipmentDie.EquipmentGuID + "',");
            strSql.Append("'" + EquipmentDie.DieType + "',");
            strSql.Append("'" + EquipmentDie.ProductType + "',");
            strSql.Append("'" + EquipmentDie.Life + "',");
            strSql.Append("'" + EquipmentDie.Energy + "',");
            strSql.Append("'" + EquipmentDie.PartName + "',");
            strSql.Append("'" + EquipmentDie.PartID + "',");
            strSql.Append("'" + EquipmentDie.ExteriorSize + "',");
            strSql.Append("'" + EquipmentDie.Datum + "',");
            strSql.Append("'" + EquipmentDie.DieSource + "',");
            strSql.Append("'" + EquipmentDie.Aperture + "'");
            strSql.Append(")");
            return(strSql.ToString());
        }
예제 #2
0
        ///<summary>
        /// 保存数据
        /// </summary>
        /// <param name="pObj">信息集实体类</param>
        /// <returns>返回保存成功(true)或失败(false)</returns>
        public void SaveBill(Equipment Equipment, EquipmentDie EquipmentDie, EquipmentFrock EquipmentFrock, EquipmentGage EquipmentGage, EquipmentOffice EquipmentOffice, EquipmentInformation EquipmentInformation)
        {
            CommonInterface pComm = CommonFactory.CreateInstance(CommonData.sql);

            try
            {
                pComm.BeginTrans();

                //保存单据主表数据
                //先删除主表数据
                string strDeleteSql = "Delete from Equipment where  EquipmentGuid='" + Equipment.EquipmentGuID + "'";
                pComm.Execute(strDeleteSql);

                //插入Equipment数据
                string strInsertSql = GetEquipment_AddSQL(Equipment);
                pComm.Execute(strInsertSql);


                switch (Equipment.EquipmentType)
                {
                case "1":
                    //删除EquipmentDie表
                    strDeleteSql = "Delete from EquipmentDie where  EquipmentGuid='" + Equipment.EquipmentGuID + "'";
                    pComm.Execute(strDeleteSql);

                    //插入EquipmentDie数据
                    strInsertSql = GetEquipmentDie_AddSQL(EquipmentDie);
                    pComm.Execute(strInsertSql);
                    break;



                case "2":
                    //删除EquipmentGage表
                    strDeleteSql = "Delete from EquipmentGage where  EquipmentGuid='" + Equipment.EquipmentGuID + "'";
                    pComm.Execute(strDeleteSql);



                    //插入EquipmentGage数据
                    strInsertSql = GetEquipmentGage_AddSQL(EquipmentGage);
                    pComm.Execute(strInsertSql);

                    break;


                case "3":
                    //删除EquipmentInformation表
                    strDeleteSql = "Delete from EquipmentInformation where  EquipmentGuid='" + Equipment.EquipmentGuID + "'";
                    pComm.Execute(strDeleteSql);



                    //插入EquipmentInformation数据
                    strInsertSql = GetEquipmentInformation_AddSQL(EquipmentInformation);
                    pComm.Execute(strInsertSql);

                    break;

                case "4":
                    //删除EquipmentOffice表
                    strDeleteSql = "Delete from EquipmentOffice where  EquipmentGuid='" + Equipment.EquipmentGuID + "'";
                    pComm.Execute(strDeleteSql);



                    //插入EquipmentOffice数据
                    strInsertSql = GetEquipmentOffice_AddSQL(EquipmentOffice);
                    pComm.Execute(strInsertSql);

                    break;



                case "5":
                    //删除EquipmentFrock表
                    strDeleteSql = "Delete from EquipmentFrock where  EquipmentGuid='" + Equipment.EquipmentGuID + "'";
                    pComm.Execute(strDeleteSql);



                    //插入EquipmentFrock数据
                    strInsertSql = GetEquipmentFrock_AddSQL(EquipmentFrock);
                    pComm.Execute(strInsertSql);

                    break;
                }

                pComm.CommitTrans();
            }
            catch (Exception e)
            {
                pComm.RollbackTrans();
                pComm.Close();
                throw e;
            }
        }