コード例 #1
0
        /// <summary>
        /// 得到新增EquipmentGage
        /// </summary>
        public string GetEquipmentGage_AddSQL(EquipmentGage EquipmentGage)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [EquipmentGage](");
            strSql.Append("GageGuID,EquipmentGuID,GageSpec,LeaveFactoryID,ScaleArea,ScalePrecision,ManageLevel,CheckType,CheckCycle,CheckUnit,AppraisalRecord");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("'" + EquipmentGage.GageGuID + "',");
            strSql.Append("'" + EquipmentGage.EquipmentGuID + "',");
            strSql.Append("'" + EquipmentGage.GageSpec + "',");
            strSql.Append("'" + EquipmentGage.LeaveFactoryID + "',");
            strSql.Append("'" + EquipmentGage.ScaleArea + "',");
            strSql.Append("'" + EquipmentGage.ScalePrecision + "',");
            strSql.Append("'" + EquipmentGage.ManageLevel + "',");
            strSql.Append("'" + EquipmentGage.CheckType + "',");
            strSql.Append("'" + EquipmentGage.CheckCycle + "',");
            strSql.Append("'" + EquipmentGage.CheckUnit + "',");
            strSql.Append("'" + EquipmentGage.AppraisalRecord + "'");
            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;
            }
        }