コード例 #1
0
ファイル: api.asmx.cs プロジェクト: Audery/Audery-Repository
 /// <summary>
 /// 修改企业信息
 /// </summary>
 /// <param name="dr"></param>
 private void modifyEenerprise(DataRow dr)
 {
     if (dr != null)
     {
         try
         {
             SOSOshop.Model.DrugsBase_Enterprise de    = new SOSOshop.Model.DrugsBase_Enterprise();
             SOSOshop.BLL.DrugsBase_Enterprise   debll = new SOSOshop.BLL.DrugsBase_Enterprise();
             de = debll.GetModel(dr["公司编号"].ToString());
             if (de == null)
             {
                 addEenerprise(dr);
                 return;
             }
             de.Address = dr["地址"].ToString();
             //de.BuyFilingStatus = (bool)dr["是否建档"] ? 1 : 2;
             de.Name        = dr["公司名称"].ToString();
             de.OfficePhone = dr["座机"].ToString();
             de.PYJM        = SOSOshop.BLL.Common.GetPY.Get(de.Name.Trim());
             de.TrueName    = dr["联系人名"].ToString();
             debll.Update(de);
         }
         catch (Exception ex)
         {
             SOSOshop.BLL.Logs.Log.LogServiceAdd(ex.Message, 0, "", "modifyEenerprise", ex.ToString(), 2);
         }
     }
 }
コード例 #2
0
ファイル: api.asmx.cs プロジェクト: Audery/Audery-Repository
        /// <summary>
        /// 新增企业
        /// </summary>
        /// <param name="dr"></param>
        private void addEenerprise(DataRow dr)
        {
            if (dr != null)
            {
                SOSOshop.Model.DrugsBase_Enterprise de    = new SOSOshop.Model.DrugsBase_Enterprise();
                SOSOshop.BLL.DrugsBase_Enterprise   debll = new SOSOshop.BLL.DrugsBase_Enterprise();
                de = debll.GetModel(dr["公司编号"].ToString());
                if (de != null)
                {
                    modifyEenerprise(dr);
                    return;
                }
                else if (de == null)
                {
                    de = new SOSOshop.Model.DrugsBase_Enterprise();
                }
                de.Address         = dr["地址"].ToString();
                de.BuyFilingStatus = 1;
                de.Code            = dr["公司编号"].ToString();
                de.Name            = dr["公司名称"].ToString();
                de.OfficePhone     = dr["座机"].ToString();
                de.Status          = 0;

                de.PYJM     = SOSOshop.BLL.Common.GetPY.Get(de.Name.Trim());
                de.TrueName = dr["联系人名"].ToString();
                debll.Add(de);
            }
        }
コード例 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SOSOshop.Model.DrugsBase_Enterprise model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("if(not exists(select 1 from DrugsBase_Enterprise where Name=@Name)) begin insert into DrugsBase_Enterprise(");
            strSql.Append("Code,PYJM,Name,Fax,Email,ShortName,TrueName,MobilePhone,OfficePhone,Province,City,Borough,Address,Money,LegalRepresentative,Nature,Limits,IncType,buyIncType,Status,TaxpayerID,SellFilingStatus,BuyFilingStatus,IsSell,IsBuy)");
            strSql.Append(" values (");
            strSql.Append("@Code,@PYJM,@Name,@Fax,@Email,@ShortName,@TrueName,@MobilePhone,@OfficePhone,@Province,@City,@Borough,@Address,@Money,@LegalRepresentative,@Nature,@Limits,@IncType,@buyIncType,@Status,@TaxpayerID,@SellFilingStatus,@BuyFilingStatus,@IsSell,@IsBuy)");
            strSql.Append(" SELECT SCOPE_IDENTITY() end");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "Code", DbType.AnsiString, model.Code);
            db.AddInParameter(dbCommand, "PYJM", DbType.AnsiString, model.PYJM);
            db.AddInParameter(dbCommand, "Name", DbType.AnsiString, model.Name);
            db.AddInParameter(dbCommand, "Fax", DbType.String, model.Fax);
            db.AddInParameter(dbCommand, "Email", DbType.String, model.Email);
            db.AddInParameter(dbCommand, "ShortName", DbType.AnsiString, model.ShortName);
            db.AddInParameter(dbCommand, "TrueName", DbType.AnsiString, model.TrueName);
            db.AddInParameter(dbCommand, "MobilePhone", DbType.AnsiString, model.MobilePhone);
            db.AddInParameter(dbCommand, "OfficePhone", DbType.AnsiString, model.OfficePhone);
            db.AddInParameter(dbCommand, "Province", DbType.Int32, model.Province);
            db.AddInParameter(dbCommand, "City", DbType.Int32, model.City);
            db.AddInParameter(dbCommand, "Borough", DbType.Int32, model.Borough);
            db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
            db.AddInParameter(dbCommand, "Money", DbType.Double, model.Money);
            db.AddInParameter(dbCommand, "LegalRepresentative", DbType.AnsiString, model.LegalRepresentative);
            db.AddInParameter(dbCommand, "Nature", DbType.Int32, model.Nature);
            db.AddInParameter(dbCommand, "Limits", DbType.AnsiString, model.Limits);
            db.AddInParameter(dbCommand, "IncType", DbType.Int32, model.IncType);
            db.AddInParameter(dbCommand, "buyIncType", DbType.Int32, model.buyIncType);
            db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "TaxpayerID", DbType.String, model.TaxpayerID);
            db.AddInParameter(dbCommand, "SellFilingStatus", DbType.Int32, model.SellFilingStatus);
            db.AddInParameter(dbCommand, "BuyFilingStatus", DbType.Int32, model.BuyFilingStatus);
            db.AddInParameter(dbCommand, "IsSell", DbType.Boolean, model.IsSell);
            db.AddInParameter(dbCommand, "IsBuy", DbType.Boolean, model.IsBuy);
            int    result;
            object obj = db.ExecuteScalar(dbCommand);

            if (obj == null)
            {
                return(0);
            }
            else if (!int.TryParse(obj.ToString(), out result))
            {
                return(0);
            }
            return(result);
        }
コード例 #4
0
        public SOSOshop.Model.DrugsBase_Enterprise GetModel(string Code)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,Code,PYJM,Name,Fax,Email,ShortName,TrueName,MobilePhone,OfficePhone,Province,City,Borough,Address,Money,LegalRepresentative,Nature,Limits,IncType,buyIncType,Status,TaxpayerID,SellFilingStatus,BuyFilingStatus,IsSell,IsBuy from DrugsBase_Enterprise ");
            strSql.Append(" where Code=@Code ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "Code", DbType.String, Code);
            SOSOshop.Model.DrugsBase_Enterprise model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
コード例 #5
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public SOSOshop.Model.DrugsBase_Enterprise ReaderBind(IDataReader dataReader)
        {
            SOSOshop.Model.DrugsBase_Enterprise model = new SOSOshop.Model.DrugsBase_Enterprise();
            object ojb;

            ojb = dataReader["ID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ID = (int)ojb;
            }
            model.Code        = dataReader["Code"].ToString();
            model.PYJM        = dataReader["PYJM"].ToString();
            model.Name        = dataReader["Name"].ToString();
            model.Fax         = dataReader["Fax"].ToString();
            model.Email       = dataReader["Email"].ToString();
            model.ShortName   = dataReader["ShortName"].ToString();
            model.TrueName    = dataReader["TrueName"].ToString();
            model.MobilePhone = dataReader["MobilePhone"].ToString();
            model.OfficePhone = dataReader["OfficePhone"].ToString();
            ojb = dataReader["Province"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Province = (int)ojb;
            }
            ojb = dataReader["City"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.City = (int)ojb;
            }
            ojb = dataReader["Borough"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Borough = (int)ojb;
            }
            model.Address = dataReader["Address"].ToString();
            ojb           = dataReader["Money"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Money = decimal.Parse(ojb.ToString());
            }
            model.LegalRepresentative = dataReader["LegalRepresentative"].ToString();
            ojb = dataReader["Nature"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Nature = (int)ojb;
            }
            model.Limits = dataReader["Limits"].ToString();
            ojb          = dataReader["IncType"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IncType = (int)ojb;
            }
            ojb = dataReader["buyIncType"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.buyIncType = (int)ojb;
            }
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = (int)ojb;
            }
            model.TaxpayerID = dataReader["TaxpayerID"].ToString();
            ojb = dataReader["SellFilingStatus"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SellFilingStatus = (int)ojb;
            }
            ojb = dataReader["BuyFilingStatus"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BuyFilingStatus = (int)ojb;
            }
            ojb = dataReader["IsSell"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsSell = (bool)ojb;
            }
            ojb = dataReader["IsBuy"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsBuy = (bool)ojb;
            }
            return(model);
        }
コード例 #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SOSOshop.Model.DrugsBase_Enterprise model)
        {
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update DrugsBase_Enterprise set ");
                strSql.Append("Code=@Code,");
                strSql.Append("PYJM=@PYJM,");
                strSql.Append("Name=@Name,");
                strSql.Append("Fax=@Fax,");
                strSql.Append("Email=@Email,");
                strSql.Append("ShortName=@ShortName,");
                strSql.Append("TrueName=@TrueName,");
                strSql.Append("MobilePhone=@MobilePhone,");
                strSql.Append("OfficePhone=@OfficePhone,");
                strSql.Append("Province=@Province,");
                strSql.Append("City=@City,");
                strSql.Append("Borough=@Borough,");
                strSql.Append("Address=@Address,");
                strSql.Append("Money=@Money,");
                strSql.Append("LegalRepresentative=@LegalRepresentative,");
                strSql.Append("Nature=@Nature,");
                strSql.Append("Limits=@Limits,");
                strSql.Append("IncType=@IncType,");
                strSql.Append("buyIncType=@buyIncType,");
                strSql.Append("Status=@Status,");
                strSql.Append("TaxpayerID=@TaxpayerID,");
                strSql.Append("SellFilingStatus=@SellFilingStatus,");
                strSql.Append("BuyFilingStatus=@BuyFilingStatus,");
                strSql.Append("IsSell=@IsSell,");
                strSql.Append("IsBuy=@IsBuy");
                strSql.Append(" where ID=@ID ");

                DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
                db.AddInParameter(dbCommand, "ID", DbType.Int32, model.ID);
                db.AddInParameter(dbCommand, "Code", DbType.AnsiString, model.Code);
                db.AddInParameter(dbCommand, "PYJM", DbType.AnsiString, model.PYJM);
                db.AddInParameter(dbCommand, "Name", DbType.AnsiString, model.Name);
                db.AddInParameter(dbCommand, "Fax", DbType.String, model.Fax);
                db.AddInParameter(dbCommand, "Email", DbType.String, model.Email);
                db.AddInParameter(dbCommand, "ShortName", DbType.AnsiString, model.ShortName);
                db.AddInParameter(dbCommand, "TrueName", DbType.AnsiString, model.TrueName);
                db.AddInParameter(dbCommand, "MobilePhone", DbType.AnsiString, model.MobilePhone);
                db.AddInParameter(dbCommand, "OfficePhone", DbType.AnsiString, model.OfficePhone);
                db.AddInParameter(dbCommand, "Province", DbType.Int32, model.Province);
                db.AddInParameter(dbCommand, "City", DbType.Int32, model.City);
                db.AddInParameter(dbCommand, "Borough", DbType.Int32, model.Borough);
                db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
                db.AddInParameter(dbCommand, "Money", DbType.Double, model.Money);
                db.AddInParameter(dbCommand, "LegalRepresentative", DbType.AnsiString, model.LegalRepresentative);
                db.AddInParameter(dbCommand, "Nature", DbType.Int32, model.Nature);
                db.AddInParameter(dbCommand, "Limits", DbType.AnsiString, model.Limits);
                db.AddInParameter(dbCommand, "IncType", DbType.Int32, model.IncType);
                db.AddInParameter(dbCommand, "buyIncType", DbType.Int32, model.buyIncType);
                db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
                db.AddInParameter(dbCommand, "TaxpayerID", DbType.String, model.TaxpayerID);
                db.AddInParameter(dbCommand, "SellFilingStatus", DbType.Int32, model.SellFilingStatus);
                db.AddInParameter(dbCommand, "BuyFilingStatus", DbType.Int32, model.BuyFilingStatus);
                db.AddInParameter(dbCommand, "IsSell", DbType.Boolean, model.IsSell);
                db.AddInParameter(dbCommand, "IsBuy", DbType.Boolean, model.IsBuy);

                int rows = db.ExecuteNonQuery(dbCommand);

                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                SOSOshop.BLL.Logs.Log.LogServiceAdd(ex.Message, 0, "", "Update", ex.ToString(), 2);
                return(false);
            }
        }