Ejemplo n.º 1
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="cASE_PRODUCTINFOEntity">实体</param>
        public int UpdateEntity(CASE_PRODUCTINFOEntity cASE_PRODUCTINFOEntity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, cASE_PRODUCTINFOEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldMODIFIEDUSERID, UserInfo.Id);
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldMODIFIEDBY, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(CASE_PRODUCTINFOTable.FieldMODIFIEDON);
            sqlBuilder.SetWhere(CASE_PRODUCTINFOTable.FieldID, cASE_PRODUCTINFOEntity.ID);
            return(sqlBuilder.EndUpdate());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="cASE_PRODUCTINFOEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, CASE_PRODUCTINFOEntity cASE_PRODUCTINFOEntity)
 {
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTCODE, cASE_PRODUCTINFOEntity.PRODUCTCODE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTNAME, cASE_PRODUCTINFOEntity.PRODUCTNAME);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTMODEL, cASE_PRODUCTINFOEntity.PRODUCTMODEL);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTSTANDARD, cASE_PRODUCTINFOEntity.PRODUCTSTANDARD);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTCATEGORY, cASE_PRODUCTINFOEntity.PRODUCTCATEGORY);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTUNIT, cASE_PRODUCTINFOEntity.PRODUCTUNIT);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTDESCRIPTION, cASE_PRODUCTINFOEntity.PRODUCTDESCRIPTION);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldMIDDLERATE, cASE_PRODUCTINFOEntity.MIDDLERATE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldREFERENCECOEFFICIENT, cASE_PRODUCTINFOEntity.REFERENCECOEFFICIENT);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPRODUCTPRICE, cASE_PRODUCTINFOEntity.PRODUCTPRICE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldWHOLESALEPRICE, cASE_PRODUCTINFOEntity.WHOLESALEPRICE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldPROMOTIONPRICE, cASE_PRODUCTINFOEntity.PROMOTIONPRICE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldINTERNALPRICE, cASE_PRODUCTINFOEntity.INTERNALPRICE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldSPECIALPRICE, cASE_PRODUCTINFOEntity.SPECIALPRICE);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldENABLED, cASE_PRODUCTINFOEntity.ENABLED);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldDESCRIPTION, cASE_PRODUCTINFOEntity.DESCRIPTION);
     sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldDELETEMARK, cASE_PRODUCTINFOEntity.DELETEMARK);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="cASE_PRODUCTINFOEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(CASE_PRODUCTINFOEntity cASE_PRODUCTINFOEntity)
 {
     return(this.AddEntity(cASE_PRODUCTINFOEntity));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="cASE_PRODUCTINFOEntity">实体</param>
        public string AddEntity(CASE_PRODUCTINFOEntity cASE_PRODUCTINFOEntity)
        {
            string sequence = string.Empty;

            this.Identity = false;
            if (cASE_PRODUCTINFOEntity.ID != null)
            {
                sequence = cASE_PRODUCTINFOEntity.ID;
            }
            SQLBuilder sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, CASE_PRODUCTINFOTable.FieldID);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(cASE_PRODUCTINFOEntity.ID))
                {
                    sequence = BusinessLogic.NewGuid();
                    cASE_PRODUCTINFOEntity.ID = sequence;
                }
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldID, cASE_PRODUCTINFOEntity.ID);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(CASE_PRODUCTINFOTable.FieldID, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(CASE_PRODUCTINFOTable.FieldID, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(cASE_PRODUCTINFOEntity.ID))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                CiSequenceManager sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            cASE_PRODUCTINFOEntity.ID = sequence;
                        }
                        sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldID, cASE_PRODUCTINFOEntity.ID);
                    }
                }
            }
            this.SetEntity(sqlBuilder, cASE_PRODUCTINFOEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldCREATEUSERID, UserInfo.Id);
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldCREATEBY, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(CASE_PRODUCTINFOTable.FieldCREATEON);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldMODIFIEDUSERID, UserInfo.Id);
                sqlBuilder.SetValue(CASE_PRODUCTINFOTable.FieldMODIFIEDBY, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(CASE_PRODUCTINFOTable.FieldMODIFIEDON);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="cASE_PRODUCTINFOEntity">实体</param>
 public int Update(CASE_PRODUCTINFOEntity cASE_PRODUCTINFOEntity)
 {
     return(this.UpdateEntity(cASE_PRODUCTINFOEntity));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="cASE_PRODUCTINFOEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(CASE_PRODUCTINFOEntity cASE_PRODUCTINFOEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(cASE_PRODUCTINFOEntity));
 }