Esempio n. 1
0
        public static int Insert(PartnerEntity partnerEntity)
        {
            if (partnerEntity.PartnerDBEntity.Count == 0)
            {
                return 0;
            }

            if (partnerEntity.LogMessages == null)
            {
                return 0;
            }

            if (CheckInsert(partnerEntity) > 0)
            {
                return 2;
            }

            PartnerDBEntity dbParm = (partnerEntity.PartnerDBEntity.Count > 0) ? partnerEntity.PartnerDBEntity[0] : new PartnerDBEntity();
            DataCommand cmd = DataCommandManager.GetDataCommand("InsertPartnerLink");
            cmd.SetParameterValue("@PartnerID", dbParm.PartnerID);
            cmd.SetParameterValue("@PartnerLink", dbParm.PartnerLink);
            cmd.SetParameterValue("@PartnerTitle", dbParm.PartnerTitle);
            cmd.SetParameterValue("@Cost", String.IsNullOrEmpty(dbParm.PartnerCost) ? "0" : dbParm.PartnerCost);
            cmd.SetParameterValue("@Remark", dbParm.Remark);
            cmd.SetParameterValue("@UserID", partnerEntity.LogMessages.Username);
            return cmd.ExecuteNonQuery();
        }
Esempio n. 2
0
        public static PartnerEntity ChartSelect(PartnerEntity partnerEntity)
        {
            PartnerDBEntity dbParm = (partnerEntity.PartnerDBEntity.Count > 0) ? partnerEntity.PartnerDBEntity[0] : new PartnerDBEntity();

            DataCommand cmd = DataCommandManager.GetDataCommand("GetPartnerLinkChartList");
            cmd.SetParameterValue("@SysID", dbParm.SysID);
            if (String.IsNullOrEmpty(dbParm.StartDTime))
            {
                cmd.SetParameterValue("@StartDTime", DBNull.Value);
            }
            else
            {
                cmd.SetParameterValue("@StartDTime", dbParm.StartDTime);
            }

            if (String.IsNullOrEmpty(dbParm.EndDTime))
            {
                cmd.SetParameterValue("@EndDTime", DBNull.Value);
            }
            else
            {
                cmd.SetParameterValue("@EndDTime", dbParm.EndDTime);
            }
            partnerEntity.QueryResult = cmd.ExecuteDataSet();
            return partnerEntity;
        }
Esempio n. 3
0
        public static int CheckInsert(PartnerEntity partnerEntity)
        {
            PartnerDBEntity dbParm = (partnerEntity.PartnerDBEntity.Count > 0) ? partnerEntity.PartnerDBEntity[0] : new PartnerDBEntity();

            DataCommand cmd = DataCommandManager.GetDataCommand("ChkInsertPartnerLink");
            cmd.SetParameterValue("@PartnerID", dbParm.PartnerID);
            cmd.SetParameterValue("@PartnerLink", dbParm.PartnerLink);
            DataSet dsResult = cmd.ExecuteDataSet();

             if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
            {
                return 1;
            }
            return 0;
        }
Esempio n. 4
0
        public static int Update(PartnerEntity partnerEntity)
        {
            partnerEntity.LogMessages.MsgType = MessageType.INFO;
            partnerEntity.LogMessages.Content = _nameSpaceClass + "Update";
            LoggerHelper.LogWriter(partnerEntity.LogMessages);

            try
            {
                return PartnerDA.Update(partnerEntity);
            }
            catch (Exception ex)
            {
                partnerEntity.LogMessages.MsgType = MessageType.ERROR;
                partnerEntity.LogMessages.Content = _nameSpaceClass + "Update  Error: " + ex.Message;
                LoggerHelper.LogWriter(partnerEntity.LogMessages);
                throw ex;
            }
        }