Exemplo n.º 1
0
        /// <summary>
        /// 修改投资资源
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(Tz888.Model.Info.CapitalSetModel model)
        {
            SqlParameter[] parameters =
            {
                //主表信息
                new SqlParameter("@InfoID",                SqlDbType.BigInt,           8),
                new SqlParameter("@Title",                 SqlDbType.VarChar,        100),
                new SqlParameter("@publishT",              SqlDbType.DateTime),
                new SqlParameter("@LoginName",             SqlDbType.Char,            10),

                new SqlParameter("@KeyWord",               SqlDbType.VarChar,         50),
                new SqlParameter("@Descript",              SqlDbType.VarChar,        100),
                new SqlParameter("@DisplayTitle",          SqlDbType.VarChar,         50),
                new SqlParameter("@FrontDisplayTime",      SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateStartTime",     SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateTerm",          SqlDbType.Int,              4),
                new SqlParameter("@TemplateID",            SqlDbType.Char,            10),
                //new SqlParameter("@HtmlFile", SqlDbType.VarChar,100),
                new SqlParameter("@AuditingStatus",        SqlDbType.TinyInt,          8),

                //投资资源表信息
                new SqlParameter("@ComAbout",              SqlDbType.VarChar,         -1),
                new SqlParameter("@ComBreif",              SqlDbType.VarChar,         -1),
                new SqlParameter("@IndustryBID",           SqlDbType.Char,            10),
                new SqlParameter("@CooperationDemandType", SqlDbType.Char,            30),
                new SqlParameter("@currency",              SqlDbType.Char,            10),
                new SqlParameter("@CapitalID",             SqlDbType.Char,            10),
                new SqlParameter("@CapitalTypeID",         SqlDbType.Char,            10),

                //联系信息
                new SqlParameter("@ComName",               SqlDbType.VarChar,        100),
                new SqlParameter("@LinkMan",               SqlDbType.VarChar,         20),
                new SqlParameter("@TelCountryCode",        SqlDbType.Char,             6),
                new SqlParameter("@TelStateCode",          SqlDbType.Char,             8),
                new SqlParameter("@TelNum",                SqlDbType.VarChar,        100),
                new SqlParameter("@FaxCountryCode",        SqlDbType.Char,             6),
                new SqlParameter("@FaxStateCode",          SqlDbType.Char,             8),
                new SqlParameter("@FaxNum",                SqlDbType.VarChar,        100),
                new SqlParameter("@Mobile",                SqlDbType.VarChar,         30),
                new SqlParameter("@Address",               SqlDbType.VarChar,        100),
                new SqlParameter("@PostCode",              SqlDbType.VarChar,         10),
                new SqlParameter("@Email",                 SqlDbType.VarChar,         50),
                new SqlParameter("@WebSite",               SqlDbType.VarChar,        200),

                //短信息
                new SqlParameter("@ShortInfoControlID",    SqlDbType.Char,            20),
                new SqlParameter("@ShortTitle",            SqlDbType.VarChar,        100),
                new SqlParameter("@ShortContent",          SqlDbType.VarChar,        100),
                new SqlParameter("@strRemark",             SqlDbType.VarChar,         50),
                new SqlParameter("@IsVip",                 SqlDbType.Int),

                //投资资源表信息 2010-7-7修改
                new SqlParameter("@RegisteredCapital",     SqlDbType.Char,            30),
                new SqlParameter("@TeamScale",             SqlDbType.Char,            30),
                new SqlParameter("@AverageInvestment",     SqlDbType.Char,            30),
                new SqlParameter("@SuccessfulInvestment",  SqlDbType.Char,            30),
                new SqlParameter("@InvestmentDemand",      SqlDbType.VarChar,        100),
                new SqlParameter("@Prorganizers",          SqlDbType.VarChar,        100),
                new SqlParameter("@CountryID",             SqlDbType.Char,            30),
                new SqlParameter("@ProvinceID",            SqlDbType.Char,            30),
                new SqlParameter("@CityID",                SqlDbType.Char,            30),
                new SqlParameter("@CountyID",              SqlDbType.Char,            30),
                new SqlParameter("@Position",              SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.MainInfoModel.InfoID;
            parameters[1].Value = model.MainInfoModel.Title;
            parameters[2].Value = model.MainInfoModel.publishT;
            parameters[3].Value = model.MainInfoModel.LoginName;

            parameters[4].Value  = model.MainInfoModel.KeyWord;
            parameters[5].Value  = model.MainInfoModel.Descript;
            parameters[6].Value  = model.MainInfoModel.DisplayTitle;
            parameters[7].Value  = model.MainInfoModel.FrontDisplayTime;
            parameters[8].Value  = model.MainInfoModel.ValidateStartTime;
            parameters[9].Value  = model.MainInfoModel.ValidateTerm;
            parameters[10].Value = model.MainInfoModel.TemplateID;
            //parameters[11].Value = model.MainInfoModel.HtmlFile;
            parameters[11].Value = model.MainInfoModel.AuditingStatus;

            parameters[12].Value = model.CapitalInfoModel.ComAbout;
            parameters[13].Value = model.CapitalInfoModel.ComBreif;
            parameters[14].Value = model.CapitalInfoModel.IndustryBID;
            parameters[15].Value = model.CapitalInfoModel.CooperationDemandType;
            parameters[16].Value = model.CapitalInfoModel.Currency;
            parameters[17].Value = model.CapitalInfoModel.CapitalID;
            parameters[18].Value = model.CapitalInfoModel.CapitalTypeID;

            parameters[19].Value = model.InfoContactModel.OrganizationName;
            parameters[20].Value = model.InfoContactModel.Name;
            parameters[21].Value = model.InfoContactModel.TelCountryCode;
            parameters[22].Value = model.InfoContactModel.TelStateCode;
            parameters[23].Value = model.InfoContactModel.TelNum;
            parameters[24].Value = model.InfoContactModel.FaxCountryCode;
            parameters[25].Value = model.InfoContactModel.FaxStateCode;
            parameters[26].Value = model.InfoContactModel.FaxNum;
            parameters[27].Value = model.InfoContactModel.Mobile;
            parameters[28].Value = model.InfoContactModel.Address;
            parameters[29].Value = model.InfoContactModel.PostCode;
            parameters[30].Value = model.InfoContactModel.Email;
            parameters[31].Value = model.InfoContactModel.WebSite;

            parameters[32].Value = model.ShortInfoModel.ShortInfoControlID;
            parameters[33].Value = model.ShortInfoModel.ShortTitle;
            parameters[34].Value = model.ShortInfoModel.ShortContent;
            parameters[35].Value = model.ShortInfoModel.Remark;
            parameters[36].Value = model.CapitalInfoModel.IsVip;

            parameters[37].Value = model.CapitalInfoModel.RegisteredCapital;
            parameters[38].Value = model.CapitalInfoModel.TeamScale;
            parameters[39].Value = model.CapitalInfoModel.AverageInvestment;
            parameters[40].Value = model.CapitalInfoModel.SuccessfulInvestment;
            parameters[41].Value = model.CapitalInfoModel.InvestmentDemand;
            parameters[42].Value = model.CapitalInfoModel.Prorganizers;
            parameters[43].Value = model.CapitalInfoModel.SCountryID;
            parameters[44].Value = model.CapitalInfoModel.SProvinceID;
            parameters[45].Value = model.CapitalInfoModel.SCityID;
            parameters[46].Value = model.CapitalInfoModel.SCountyID;
            parameters[47].Value = model.InfoContactModel.Position;

            bool ReturnValue = false;
            long infoID      = model.MainInfoModel.InfoID;

            using (SqlConnection sqlConn = DbHelperSQL.GetSqlConnection())
            {
                sqlConn.Open();
                SqlTransaction sqlTran = sqlConn.BeginTransaction();
                try
                {
                    int rowsAffected;
                    //插入投资资源信息
                    DbHelperSQL.RunProcedure(sqlConn, sqlTran, "CapitalInfoTab_Update", parameters, out rowsAffected);

                    string countrycode = "";
                    string ProvinceID  = "";
                    string CityID      = "";
                    string countyID    = "";

                    //为投资资源更新投资区域信息
                    Tz888.SQLServerDAL.Info.CapitalInfoAreaDAL obj1 = new CapitalInfoAreaDAL();
                    obj1.DeleteByInfoID(sqlConn, sqlTran, infoID);
                    if (model.CapitalInfoAreaModels != null)
                    {
                        foreach (Tz888.Model.Info.CapitalInfoAreaModel tmpModel in model.CapitalInfoAreaModels)
                        {
                            tmpModel.InfoID = infoID;
                            obj1.Insert(sqlConn, sqlTran, tmpModel);

                            if (!string.IsNullOrEmpty(tmpModel.CountryCode))
                            {
                                countrycode += tmpModel.CountryCode.Trim() + ",";
                            }
                            if (!string.IsNullOrEmpty(tmpModel.ProvinceID))
                            {
                                ProvinceID += tmpModel.ProvinceID.Trim() + ",";
                            }
                            if (!string.IsNullOrEmpty(tmpModel.CityID))
                            {
                                CityID += tmpModel.CityID.Trim() + ",";
                            }
                            if (!string.IsNullOrEmpty(tmpModel.CountyID))
                            {
                                countyID += tmpModel.CountyID.Trim() + ",";
                            }
                        }
                    }

                    //为投资资源更新联系人信息
                    Tz888.SQLServerDAL.Info.InfoContactManDAL obj2 = new InfoContactManDAL();
                    obj2.DeleteByInfoID(sqlConn, sqlTran, infoID);
                    if (model.InfoContactManModels != null)
                    {
                        foreach (Tz888.Model.Info.InfoContactManModel tmpModel in model.InfoContactManModels)
                        {
                            tmpModel.InfoID = infoID;
                            obj2.InsertContactMan(sqlConn, sqlTran, tmpModel);
                        }
                    }

                    //为投资信息添加多个资源
                    Tz888.SQLServerDAL.Info.InfoResourceDAL obj3 = new InfoResourceDAL();
                    obj3.DeleteByInfoID(sqlConn, sqlTran, infoID);
                    if (model.InfoResourceModels != null)
                    {
                        foreach (Tz888.Model.Info.InfoResourceModel tmpModel in model.InfoResourceModels)
                        {
                            tmpModel.InfoID = infoID;
                            obj3.InsertInfoResource(sqlConn, sqlTran, tmpModel);
                        }
                    }
                    ReturnValue = true;

                    //序列化投资区域信息
                    this.CapitalInfoAreaQuery(infoID, countrycode, ProvinceID, CityID, countyID);

                    sqlTran.Commit();
                }
                catch
                {
                    sqlTran.Rollback();
                    ReturnValue = false;
                }
                finally
                {
                    sqlConn.Close();
                }
            }
            return(ReturnValue);
        }
Exemplo n.º 2
0
        public bool Update(Tz888.Model.Info.MerchantSetModel model)
        {
            SqlParameter[] parameters =
            {
                //主表信息
                new SqlParameter("@InfoID",                SqlDbType.BigInt,           8),
                new SqlParameter("@Title",                 SqlDbType.VarChar,        100),
                new SqlParameter("@publishT",              SqlDbType.DateTime),
                new SqlParameter("@LoginName",             SqlDbType.Char,            10), //4

                new SqlParameter("@KeyWord",               SqlDbType.VarChar,         50),
                new SqlParameter("@Descript",              SqlDbType.VarChar,        100),
                new SqlParameter("@DisplayTitle",          SqlDbType.VarChar,         50),
                new SqlParameter("@FrontDisplayTime",      SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateStartTime",     SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateTerm",          SqlDbType.Int,              4),
                new SqlParameter("@TemplateID",            SqlDbType.Char,            10),
                new SqlParameter("@HtmlFile",              SqlDbType.VarChar,        100),                    //8

                //招商信息
                new SqlParameter("@MerchantTypeID",        SqlDbType.Char,            10),
                new SqlParameter("@IndustryClassList",     SqlDbType.VarChar,        150),
                new SqlParameter("@CapitalCurrency",       SqlDbType.Char,            10),
                new SqlParameter("@CapitalTotal",          SqlDbType.Float,            8),
                new SqlParameter("@MerchantCurrency",      SqlDbType.Char,            10),
                new SqlParameter("@MerchantTotal",         SqlDbType.Char,            10),
                new SqlParameter("@CooperationDemandType", SqlDbType.VarChar,         30),
                new SqlParameter("@CountryCode",           SqlDbType.Char,            10),
                new SqlParameter("@ProvinceID",            SqlDbType.Char,            10),
                new SqlParameter("@CityID",                SqlDbType.Char,            10),
                new SqlParameter("@CountyID",              SqlDbType.Char,            10),
                new SqlParameter("@ZoneAbout",             SqlDbType.VarChar,         -1),
                new SqlParameter("@ZoneAboutBrief",        SqlDbType.VarChar,         -1),
                new SqlParameter("@ReceiveOrganization",   SqlDbType.VarChar,        100),
                new SqlParameter("@MerchantOrganization",  SqlDbType.Int,              4),                          //15

                //联系信息
                new SqlParameter("@Organization",          SqlDbType.VarChar,        100),
                new SqlParameter("@LinkMan",               SqlDbType.VarChar,         20),
                new SqlParameter("@TelCountryCode",        SqlDbType.Char,             6),
                new SqlParameter("@TelStateCode",          SqlDbType.Char,             8),
                new SqlParameter("@TelNum",                SqlDbType.VarChar,        100),
                new SqlParameter("@FaxCountryCode",        SqlDbType.Char,             6),
                new SqlParameter("@FaxStateCode",          SqlDbType.Char,             8),
                new SqlParameter("@FaxNum",                SqlDbType.VarChar,        100),
                new SqlParameter("@Mobile",                SqlDbType.VarChar,         30),
                new SqlParameter("@Address",               SqlDbType.VarChar,        100),
                new SqlParameter("@PostCode",              SqlDbType.VarChar,         10),
                new SqlParameter("@Email",                 SqlDbType.VarChar,         50),
                new SqlParameter("@WebSite",               SqlDbType.VarChar,        200), //13

                //短信息表
                new SqlParameter("@ShortInfoControlID",    SqlDbType.Char,            20),
                new SqlParameter("@ShortTitle",            SqlDbType.VarChar,        100),
                new SqlParameter("@ShortContent",          SqlDbType.VarChar,        100),
                new SqlParameter("@strRemark",             SqlDbType.VarChar,         50),
                //2010-06-11新增的
                new SqlParameter("@PriceByUser",           SqlDbType.Int,              4),


                //这里是2010-06-11 添加政府招商的参数 有5个参数
                new SqlParameter("@EconomicIndicators",    SqlDbType.NVarChar,       100),
                new SqlParameter("@InvestmentEnvironment", SqlDbType.NVarChar,       100),
                new SqlParameter("@ProjectStatus",         SqlDbType.NVarChar,       100),
                new SqlParameter("@Market",                SqlDbType.NVarChar,       100),
                new SqlParameter("@Benefit",               SqlDbType.NVarChar,       100), //10

                new SqlParameter("@InformationIntegrity",  SqlDbType.Int,              8),
                new SqlParameter("@Position",              SqlDbType.VarChar,         50),
                new SqlParameter("@Merchanreturns",        SqlDbType.Int,              8),
            };
            parameters[0].Value = model.MainInfoModel.InfoID;
            parameters[1].Value = model.MainInfoModel.Title;
            parameters[2].Value = model.MainInfoModel.publishT;
            parameters[3].Value = model.MainInfoModel.LoginName;

            parameters[4].Value  = model.MainInfoModel.KeyWord;
            parameters[5].Value  = model.MainInfoModel.Descript;
            parameters[6].Value  = model.MainInfoModel.DisplayTitle;
            parameters[7].Value  = model.MainInfoModel.FrontDisplayTime;
            parameters[8].Value  = model.MainInfoModel.ValidateStartTime;
            parameters[9].Value  = model.MainInfoModel.ValidateTerm;
            parameters[10].Value = model.MainInfoModel.TemplateID;
            parameters[11].Value = model.MainInfoModel.HtmlFile;

            parameters[12].Value = model.MerchantInfoModel.MerchantTypeID;
            parameters[13].Value = model.MerchantInfoModel.IndustryClassList;
            parameters[14].Value = model.MerchantInfoModel.CapitalCurrency;
            parameters[15].Value = model.MerchantInfoModel.CapitalTotal;
            parameters[16].Value = model.MerchantInfoModel.MerchantCurrency;
            parameters[17].Value = model.MerchantInfoModel.MerchantTotal;
            parameters[18].Value = model.MerchantInfoModel.CooperationDemandType;
            parameters[19].Value = model.MerchantInfoModel.CountryCode;
            parameters[20].Value = model.MerchantInfoModel.ProvinceID;
            parameters[21].Value = model.MerchantInfoModel.CityID;
            parameters[22].Value = model.MerchantInfoModel.CountyID;
            parameters[23].Value = model.MerchantInfoModel.ZoneAbout;
            parameters[24].Value = model.MerchantInfoModel.ZoneAboutBrief;
            parameters[25].Value = model.MerchantInfoModel.ReceiveOrganization;
            parameters[26].Value = model.MerchantInfoModel.MerchantOrganization;

            parameters[27].Value = model.InfoContactModel.OrganizationName;
            parameters[28].Value = model.InfoContactModel.Name;
            parameters[29].Value = model.InfoContactModel.TelCountryCode;
            parameters[30].Value = model.InfoContactModel.TelStateCode;
            parameters[31].Value = model.InfoContactModel.TelNum;
            parameters[32].Value = model.InfoContactModel.FaxCountryCode;
            parameters[33].Value = model.InfoContactModel.FaxStateCode;
            parameters[34].Value = model.InfoContactModel.FaxNum;
            parameters[35].Value = model.InfoContactModel.Mobile;
            parameters[36].Value = model.InfoContactModel.Address;
            parameters[37].Value = model.InfoContactModel.PostCode;
            parameters[38].Value = model.InfoContactModel.Email;
            parameters[39].Value = model.InfoContactModel.WebSite;


            parameters[40].Value = model.ShortInfoModel.ShortInfoControlID;
            parameters[41].Value = model.ShortInfoModel.ShortTitle;
            parameters[42].Value = model.ShortInfoModel.ShortContent;
            parameters[43].Value = model.ShortInfoModel.Remark;



            //2010-06-11以下是根据需求添加的
            parameters[44].Value = 1;
            parameters[45].Value = model.MerchantInfoModel.EconomicIndicators;
            parameters[46].Value = model.MerchantInfoModel.InvestmentEnvironment;
            parameters[47].Value = model.MerchantInfoModel.ProjectStatus;
            parameters[48].Value = model.MerchantInfoModel.Market;
            parameters[49].Value = model.MerchantInfoModel.Benefit;
            //添加信息完整度
            parameters[50].Value = model.MerchantInfoModel.InformationIntegrity;
            //2010-06-11以下是招商联系人职位
            parameters[51].Value = model.InfoContactModel.Position;
            parameters[52].Value = model.MerchantInfoModel.Merchanreturns;
            //End

            bool ReturnValue = false;
            long infoID      = model.MainInfoModel.InfoID;

            using (SqlConnection sqlConn = DbHelperSQL.GetSqlConnection())
            {
                sqlConn.Open();
                SqlTransaction sqlTran = sqlConn.BeginTransaction();
                try
                {
                    int rowsAffected;
                    //修改招商信息
                    DbHelperSQL.RunProcedure(sqlConn, sqlTran, "MerchantInfoTab_Update", parameters, out rowsAffected);

                    //为招商信息更新联系人信息
                    Tz888.SQLServerDAL.Info.InfoContactManDAL obj2 = new InfoContactManDAL();
                    obj2.DeleteByInfoID(sqlConn, sqlTran, infoID);
                    //if (model.InfoContactManModels != null)
                    //{
                    //    foreach (Tz888.Model.Info.InfoContactManModel tmpModel in model.InfoContactManModels)
                    //    {
                    //        tmpModel.InfoID = infoID;
                    //        obj2.InsertContactMan(sqlConn, sqlTran, tmpModel);
                    //    }
                    //}

                    //为招商信息添加多个资源
                    Tz888.SQLServerDAL.Info.InfoResourceDAL obj3 = new InfoResourceDAL();
                    obj3.DeleteByInfoID(sqlConn, sqlTran, infoID);
                    if (model.InfoResourceModels != null)
                    {
                        foreach (Tz888.Model.Info.InfoResourceModel tmpModel in model.InfoResourceModels)
                        {
                            tmpModel.InfoID = infoID;
                            obj3.InsertInfoResource(sqlConn, sqlTran, tmpModel);
                        }
                    }
                    sqlTran.Commit();
                    ReturnValue = true;
                }
                catch
                {
                    sqlTran.Rollback();
                    ReturnValue = false;
                }
                finally
                {
                    sqlConn.Close();
                }
            }
            return(ReturnValue);
        }
Exemplo n.º 3
0
        public long Insert(
            Tz888.Model.Info.MainInfoModel mainInfoModel,
            Tz888.Model.Info.CapitalInfoModel capitalInfoModel,
            Tz888.Model.Info.InfoContactModel infoContactModel,
            Tz888.Model.Info.ShortInfoModel shortInfoModel,
            List <Tz888.Model.Info.CapitalInfoAreaModel> capitalInfoAreaModels,
            // List<Tz888.Model.Info.InfoContactManModel> infoContactManModels,
            List <Tz888.Model.Info.InfoResourceModel> infoResourceModels
            )
        {
            SqlParameter[] parameters =
            {
                //---------------------资源信息主体----------------------
                new SqlParameter("@InfoID",                  SqlDbType.BigInt,           8),
                new SqlParameter("@Title",                   SqlDbType.VarChar,        100),
                new SqlParameter("@InfoCode",                SqlDbType.Char,            30),
                new SqlParameter("@publishT",                SqlDbType.DateTime),
                new SqlParameter("@Hit",                     SqlDbType.BigInt,           8),

                new SqlParameter("@IsCore",                  SqlDbType.Bit,              1),
                new SqlParameter("@IndexOrderNum",           SqlDbType.BigInt,           8),
                new SqlParameter("@IndexTopValidateDate",    SqlDbType.Int,              4),
                new SqlParameter("@IndexPicInfoNum",         SqlDbType.BigInt,           8),
                new SqlParameter("@InfoTypeOrderNum",        SqlDbType.BigInt,           8),
                new SqlParameter("@InfoTypeTopValidateDate", SqlDbType.Int,              4),
                new SqlParameter("@InfoTypePicInfoNum",      SqlDbType.BigInt,           8),
                new SqlParameter("@LoginName",               SqlDbType.Char,            16),
                new SqlParameter("@InfoOriginRoleName",      SqlDbType.Char,            10),
                new SqlParameter("@GradeID",                 SqlDbType.Char,            10),
                new SqlParameter("@FixPriceID",              SqlDbType.Char,            10),

                new SqlParameter("@FeeStatus",               SqlDbType.TinyInt,          1),

                new SqlParameter("@KeyWord",                 SqlDbType.VarChar,         50),
                new SqlParameter("@Descript",                SqlDbType.VarChar,        100),
                new SqlParameter("@DisplayTitle",            SqlDbType.VarChar,         50),
                new SqlParameter("@FrontDisplayTime",        SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateStartTime",       SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateTerm",            SqlDbType.Int,              4),
                new SqlParameter("@TemplateID",              SqlDbType.Char,            10),
                new SqlParameter("@HtmlFile",                SqlDbType.VarChar,        100),

                //---------------------------END---------------------------

                //--------------------投资资源个性信息---------------------

                new SqlParameter("@ComAbout",                SqlDbType.VarChar,         -1),
                new SqlParameter("@ComBreif",                SqlDbType.VarChar,         -1),
                //new SqlParameter("@CountryCode", SqlDbType.Char,10),
                //new SqlParameter("@ProvinceID", SqlDbType.Char,10),
                //new SqlParameter("@CityID", SqlDbType.Char,10),
                //new SqlParameter("@CountyID", SqlDbType.Char,10),
                new SqlParameter("@IndustryBID",             SqlDbType.Char,            10),
                new SqlParameter("@CooperationDemandType",   SqlDbType.Char,            30),
                new SqlParameter("@currency",                SqlDbType.Char,            10),
                new SqlParameter("@CapitalID",               SqlDbType.Char,            10),
                new SqlParameter("@CapitalTypeID",           SqlDbType.Char,            10),

                //---------------------------END---------------------------

                //-----------------------资源联系信息--------------------------

                new SqlParameter("@ComName",                 SqlDbType.VarChar,         40),
                new SqlParameter("@LinkMan",                 SqlDbType.VarChar,         20),
                new SqlParameter("@TelCountryCode",          SqlDbType.Char,             3),
                new SqlParameter("@TelStateCode",            SqlDbType.Char,             4),
                new SqlParameter("@TelNum",                  SqlDbType.VarChar,         60),
                new SqlParameter("@FaxCountryCode",          SqlDbType.Char,             3),
                new SqlParameter("@FaxStateCode",            SqlDbType.Char,             4),
                new SqlParameter("@FaxNum",                  SqlDbType.VarChar,         60),

                new SqlParameter("@Mobile",                  SqlDbType.VarChar,         30),
                new SqlParameter("@Address",                 SqlDbType.VarChar,        100),
                new SqlParameter("@PostCode",                SqlDbType.VarChar,         10),
                new SqlParameter("@Email",                   SqlDbType.VarChar,         50),
                new SqlParameter("@WebSite",                 SqlDbType.VarChar,        200),

                //---------------------------END---------------------------

                //-------------------------短信息--------------------------

                new SqlParameter("@ShortInfoControlID",      SqlDbType.Char,            20),
                new SqlParameter("@ShortTitle",              SqlDbType.VarChar,        100),
                new SqlParameter("@ShortContent",            SqlDbType.VarChar,        100),
                new SqlParameter("@strRemark",               SqlDbType.VarChar,         50),

                //---------------------------END---------------------------
                new SqlParameter("@RegisteredCapital",       SqlDbType.Char,            30),
            };

            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = mainInfoModel.Title;
            parameters[2].Value     = mainInfoModel.InfoCode;
            parameters[3].Value     = mainInfoModel.publishT;
            parameters[4].Value     = mainInfoModel.Hit;

            parameters[5].Value  = mainInfoModel.IsCore;
            parameters[6].Value  = mainInfoModel.IndexOrderNum;
            parameters[7].Value  = mainInfoModel.IndexTopValidateDate;
            parameters[8].Value  = mainInfoModel.IndexPicInfoNum;
            parameters[9].Value  = mainInfoModel.InfoTypeOrderNum;
            parameters[10].Value = mainInfoModel.InfoTypeTopValidateDate;
            parameters[11].Value = mainInfoModel.InfoTypePicInfoNum;
            parameters[12].Value = mainInfoModel.LoginName;
            parameters[13].Value = mainInfoModel.InfoOriginRoleName;
            parameters[14].Value = mainInfoModel.GradeID;
            parameters[15].Value = mainInfoModel.FixPriceID;
            parameters[16].Value = mainInfoModel.FeeStatus;

            parameters[17].Value = mainInfoModel.KeyWord;
            parameters[18].Value = mainInfoModel.Descript;
            parameters[19].Value = mainInfoModel.DisplayTitle;
            parameters[20].Value = mainInfoModel.FrontDisplayTime;
            parameters[21].Value = mainInfoModel.ValidateStartTime;
            parameters[22].Value = mainInfoModel.ValidateTerm;
            parameters[23].Value = mainInfoModel.TemplateID;
            parameters[24].Value = mainInfoModel.HtmlFile;

            parameters[25].Value = capitalInfoModel.ComAbout;
            parameters[26].Value = capitalInfoModel.ComBreif;
            //parameters[25].Value = capitalInfoModel.CountryCode;
            //parameters[26].Value = capitalInfoModel.ProvinceID;
            //parameters[27].Value = capitalInfoModel.CityID;
            //parameters[28].Value = capitalInfoModel.CountyID;
            parameters[27].Value = capitalInfoModel.IndustryBID;
            parameters[28].Value = capitalInfoModel.CooperationDemandType;
            parameters[29].Value = capitalInfoModel.Currency;
            parameters[30].Value = capitalInfoModel.CapitalID;
            parameters[31].Value = capitalInfoModel.CapitalTypeID;

            parameters[32].Value = infoContactModel.OrganizationName;
            parameters[33].Value = infoContactModel.Name;
            parameters[34].Value = infoContactModel.TelCountryCode;
            parameters[35].Value = infoContactModel.TelStateCode;
            parameters[36].Value = infoContactModel.TelNum;
            parameters[37].Value = infoContactModel.FaxCountryCode;
            parameters[38].Value = infoContactModel.FaxStateCode;
            parameters[39].Value = infoContactModel.FaxNum;
            parameters[40].Value = infoContactModel.Mobile;
            parameters[41].Value = infoContactModel.Address;
            parameters[42].Value = infoContactModel.PostCode;
            parameters[43].Value = infoContactModel.Email;
            parameters[44].Value = infoContactModel.WebSite;

            parameters[45].Value = shortInfoModel.ShortInfoControlID;
            parameters[46].Value = shortInfoModel.ShortTitle;
            parameters[47].Value = shortInfoModel.ShortContent;
            parameters[48].Value = shortInfoModel.Remark;
            parameters[49].Value = capitalInfoModel.IsVip;
            parameters[50].Value = capitalInfoModel.RegisteredCapital;

            int  rowsAffected;
            long infoID;

            using (SqlConnection sqlConn = DbHelperSQL.GetSqlConnection())
            {
                sqlConn.Open();
                SqlTransaction sqlTran = sqlConn.BeginTransaction();
                try
                {
                    //插入投资资源信息
                    DbHelperSQL.RunProcedure(sqlConn, sqlTran, SP_CapitalInfoInfo_Insert, parameters, out rowsAffected);
                    infoID = (long)parameters[0].Value;
                    if (infoID < 0)
                    {
                        throw new Exception();
                    }

                    string countrycode = "";
                    string ProvinceID  = "";
                    string CityID      = "";
                    string countyID    = "";

                    if (capitalInfoAreaModels != null)
                    {
                        //为投资信息添加多个投资区域
                        Tz888.SQLServerDAL.Info.CapitalInfoAreaDAL obj1 = new CapitalInfoAreaDAL();
                        foreach (Tz888.Model.Info.CapitalInfoAreaModel model in capitalInfoAreaModels)
                        {
                            model.InfoID = infoID;
                            obj1.Insert(sqlConn, sqlTran, model);

                            if (!string.IsNullOrEmpty(model.CountryCode))
                            {
                                countrycode += model.CountryCode.Trim() + ",";
                            }
                            if (!string.IsNullOrEmpty(model.ProvinceID))
                            {
                                ProvinceID += model.ProvinceID.Trim() + ",";
                            }
                            if (!string.IsNullOrEmpty(model.CityID))
                            {
                                CityID += model.CityID.Trim() + ",";
                            }
                            if (!string.IsNullOrEmpty(model.CountyID))
                            {
                                countyID += model.CountyID.Trim() + ",";
                            }
                        }

                        //序列化投资区域信息
                        this.CapitalInfoAreaQuery(infoID, countrycode, ProvinceID, CityID, countyID);
                    }

                    //if (infoContactManModels != null)
                    //{
                    //    //为投资资源添加多个联系人
                    //    Tz888.SQLServerDAL.Info.InfoContactManDAL obj2 = new InfoContactManDAL();
                    //    foreach (Tz888.Model.Info.InfoContactManModel model in infoContactManModels)
                    //    {
                    //        model.InfoID = infoID;
                    //        obj2.InsertContactMan(sqlConn, sqlTran, model);
                    //    }
                    //}

                    if (infoResourceModels != null)
                    {
                        //为投资信息添加多个资源
                        Tz888.SQLServerDAL.Info.InfoResourceDAL obj3 = new InfoResourceDAL();
                        foreach (Tz888.Model.Info.InfoResourceModel model in infoResourceModels)
                        {
                            model.InfoID = infoID;
                            obj3.InsertInfoResource(sqlConn, sqlTran, model);
                        }
                    }

                    sqlTran.Commit();
                }
                catch
                {
                    sqlTran.Rollback();
                    infoID = -1;
                }
                finally
                {
                    sqlConn.Close();
                }
            }

            return(infoID);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 添加招商资源信息
        /// </summary>
        /// <param name="mainInfoModel">资源信息主体</param>
        /// <param name="merchantInfoModel">招商资源个性信息</param>
        /// <param name="infoContactModel">资源联系信息</param>
        /// <param name="shortInfoModel">资源短信息</param>
        /// <param name="infoContactManModels">多联系人列表</param>
        /// <returns>招商资源ID</returns>
        public long Insert(
            Tz888.Model.Info.MainInfoModel mainInfoModel,
            Tz888.Model.Info.MerchantInfoModel merchantInfoModel,
            Tz888.Model.Info.InfoContactModel infoContactModel,
            Tz888.Model.Info.ShortInfoModel shortInfoModel,
            // List<Tz888.Model.Info.InfoContactManModel> infoContactManModels,
            List <Tz888.Model.Info.InfoResourceModel> infoResourceModels
            )
        {
            SqlParameter[] parameters =
            {
                //---------------------资源信息主体----------------------
                new SqlParameter("@InfoID",                  SqlDbType.BigInt,           8),
                new SqlParameter("@Title",                   SqlDbType.VarChar,        100),
                new SqlParameter("@InfoCode",                SqlDbType.Char,            30),
                new SqlParameter("@publishT",                SqlDbType.DateTime),
                new SqlParameter("@Hit",                     SqlDbType.BigInt,           8),

                new SqlParameter("@IsCore",                  SqlDbType.Bit,              1),
                new SqlParameter("@IndexOrderNum",           SqlDbType.BigInt,           8),
                new SqlParameter("@IndexTopValidateDate",    SqlDbType.Int,              4),
                new SqlParameter("@IndexPicInfoNum",         SqlDbType.BigInt,           8),
                new SqlParameter("@InfoTypeOrderNum",        SqlDbType.BigInt,           8),
                new SqlParameter("@InfoTypeTopValidateDate", SqlDbType.Int,              4),
                new SqlParameter("@InfoTypePicInfoNum",      SqlDbType.BigInt,           8),
                new SqlParameter("@LoginName",               SqlDbType.Char,            16),
                new SqlParameter("@InfoOriginRoleName",      SqlDbType.Char,            10),
                new SqlParameter("@GradeID",                 SqlDbType.Char,            10),
                new SqlParameter("@FixPriceID",              SqlDbType.Char,            10),

                new SqlParameter("@FeeStatus",               SqlDbType.TinyInt,          1),

                new SqlParameter("@KeyWord",                 SqlDbType.VarChar,         50),
                new SqlParameter("@Descript",                SqlDbType.VarChar,        100),
                new SqlParameter("@DisplayTitle",            SqlDbType.VarChar,         50),
                new SqlParameter("@FrontDisplayTime",        SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateStartTime",       SqlDbType.SmallDateTime),
                new SqlParameter("@ValidateTerm",            SqlDbType.Int,              4),
                new SqlParameter("@TemplateID",              SqlDbType.Char,            10),
                new SqlParameter("@HtmlFile",                SqlDbType.VarChar,        100),


                //---------------------------END---------------------------

                //--------------------招商资源个性信息---------------------

                new SqlParameter("@MerchantTypeID",          SqlDbType.Char,            10),
                new SqlParameter("@IndustryClassList",       SqlDbType.VarChar,        150),
                new SqlParameter("@CapitalCurrency",         SqlDbType.Char,            10),
                new SqlParameter("@CapitalTotal",            SqlDbType.Float,            8),
                new SqlParameter("@MerchantCurrency",        SqlDbType.Char,            10),
                new SqlParameter("@MerchantTotal",           SqlDbType.Char,            10),
                new SqlParameter("@CooperationDemandType",   SqlDbType.VarChar,         30),
                new SqlParameter("@CountryCode",             SqlDbType.Char,            10),
                new SqlParameter("@ProvinceID",              SqlDbType.Char,            10),
                new SqlParameter("@CityID",                  SqlDbType.Char,            10),
                new SqlParameter("@CountyID",                SqlDbType.Char,            10),
                new SqlParameter("@ZoneAbout",               SqlDbType.VarChar,         -1),
                new SqlParameter("@ZoneAboutBrief",          SqlDbType.VarChar,         -1),
                new SqlParameter("@ReceiveOrganization",     SqlDbType.VarChar,        100),
                new SqlParameter("@MerchantOrganization",    SqlDbType.Int,              4),


                //---------------------------END---------------------------

                //-----------------------资源联系信息--------------------------

                new SqlParameter("@Organization",            SqlDbType.VarChar,         40),
                new SqlParameter("@LinkMan",                 SqlDbType.VarChar,         20),
                new SqlParameter("@TelCountryCode",          SqlDbType.Char,             3),
                new SqlParameter("@TelStateCode",            SqlDbType.Char,             4),
                new SqlParameter("@TelNum",                  SqlDbType.VarChar,         60),
                new SqlParameter("@FaxCountryCode",          SqlDbType.Char,             3),
                new SqlParameter("@FaxStateCode",            SqlDbType.Char,             4),
                new SqlParameter("@FaxNum",                  SqlDbType.VarChar,         60),

                new SqlParameter("@Mobile",                  SqlDbType.VarChar,         30),
                new SqlParameter("@Address",                 SqlDbType.VarChar,        100),
                new SqlParameter("@PostCode",                SqlDbType.VarChar,         10),
                new SqlParameter("@Email",                   SqlDbType.VarChar,         50),
                new SqlParameter("@WebSite",                 SqlDbType.VarChar,        200),

                //---------------------------END---------------------------

                //-------------------------短信息--------------------------

                new SqlParameter("@ShortInfoControlID",      SqlDbType.Char,            20),
                new SqlParameter("@ShortTitle",              SqlDbType.VarChar,        100),
                new SqlParameter("@ShortContent",            SqlDbType.VarChar,        100),
                new SqlParameter("@strRemark",               SqlDbType.VarChar,         50),
                //这里是2010-06-01 添加政府招商的参数 有5个参数
                new SqlParameter("@EconomicIndicators",      SqlDbType.NVarChar,       100),
                new SqlParameter("@InvestmentEnvironment",   SqlDbType.NVarChar,       100),
                new SqlParameter("@ProjectStatus",           SqlDbType.NVarChar,       100),
                new SqlParameter("@Market",                  SqlDbType.NVarChar,       100),
                new SqlParameter("@Benefit",                 SqlDbType.NVarChar,       100),
                //新添加结束处
                //这里是2010-06-02添加政府招商联系信息的参数
                new SqlParameter("@Position",                SqlDbType.VarChar,         50),
                //这里是2010-06-08添加信息完整度
                new SqlParameter("@InformationIntegrity",    SqlDbType.Int,              8),
                new SqlParameter("@Merchanreturns",          SqlDbType.Int, 8)


                //---------------------------END---------------------------
            };

            //---------------------资源信息主体参数----------------------
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = mainInfoModel.Title;
            parameters[2].Value     = mainInfoModel.InfoCode;
            parameters[3].Value     = mainInfoModel.publishT;
            parameters[4].Value     = mainInfoModel.Hit;

            parameters[5].Value  = mainInfoModel.IsCore;
            parameters[6].Value  = mainInfoModel.IndexOrderNum;
            parameters[7].Value  = mainInfoModel.IndexTopValidateDate;
            parameters[8].Value  = mainInfoModel.IndexPicInfoNum;
            parameters[9].Value  = mainInfoModel.InfoTypeOrderNum;
            parameters[10].Value = mainInfoModel.InfoTypeTopValidateDate;
            parameters[11].Value = mainInfoModel.InfoTypePicInfoNum;
            parameters[12].Value = mainInfoModel.LoginName;
            parameters[13].Value = mainInfoModel.InfoOriginRoleName;
            parameters[14].Value = mainInfoModel.GradeID;
            parameters[15].Value = mainInfoModel.FixPriceID;
            parameters[16].Value = mainInfoModel.FeeStatus;

            parameters[17].Value = mainInfoModel.KeyWord;
            parameters[18].Value = mainInfoModel.Descript;
            parameters[19].Value = mainInfoModel.DisplayTitle;
            parameters[20].Value = mainInfoModel.FrontDisplayTime;
            parameters[21].Value = mainInfoModel.ValidateStartTime;
            parameters[22].Value = mainInfoModel.ValidateTerm;
            parameters[23].Value = mainInfoModel.TemplateID;
            parameters[24].Value = mainInfoModel.HtmlFile;



            //End
            parameters[25].Value = merchantInfoModel.MerchantTypeID;
            parameters[26].Value = merchantInfoModel.IndustryClassList;
            parameters[27].Value = merchantInfoModel.CapitalCurrency;
            parameters[28].Value = merchantInfoModel.CapitalTotal;
            parameters[29].Value = merchantInfoModel.MerchantCurrency;
            parameters[30].Value = merchantInfoModel.MerchantTotal;
            parameters[31].Value = merchantInfoModel.CooperationDemandType;
            parameters[32].Value = merchantInfoModel.CountryCode;
            parameters[33].Value = merchantInfoModel.ProvinceID;
            parameters[34].Value = merchantInfoModel.CityID;
            parameters[35].Value = merchantInfoModel.CountyID;
            parameters[36].Value = merchantInfoModel.ZoneAbout;
            parameters[37].Value = merchantInfoModel.ZoneAboutBrief;
            parameters[38].Value = merchantInfoModel.ReceiveOrganization;
            parameters[39].Value = merchantInfoModel.MerchantOrganization;
            //2010-06-01以下是根据需求添加的
            parameters[57].Value = merchantInfoModel.EconomicIndicators;
            parameters[58].Value = merchantInfoModel.InvestmentEnvironment;
            parameters[59].Value = merchantInfoModel.ProjectStatus;
            parameters[60].Value = merchantInfoModel.Market;
            parameters[61].Value = merchantInfoModel.Benefit;
            //添加信息完整度
            parameters[63].Value = merchantInfoModel.InformationIntegrity;
            //End



            parameters[40].Value = infoContactModel.OrganizationName;
            parameters[41].Value = infoContactModel.Name;
            parameters[42].Value = infoContactModel.TelCountryCode;
            parameters[43].Value = infoContactModel.TelStateCode;
            parameters[44].Value = infoContactModel.TelNum;
            parameters[45].Value = infoContactModel.FaxCountryCode;
            parameters[46].Value = infoContactModel.FaxStateCode;
            parameters[47].Value = infoContactModel.FaxNum;
            parameters[48].Value = infoContactModel.Mobile;
            parameters[49].Value = infoContactModel.Address;
            parameters[50].Value = infoContactModel.PostCode;
            parameters[51].Value = infoContactModel.Email;
            parameters[52].Value = infoContactModel.WebSite;
            //2010-06-02以下是招商联系人职位
            parameters[62].Value = infoContactModel.Position;
            //end

            parameters[53].Value = shortInfoModel.ShortInfoControlID;
            parameters[54].Value = shortInfoModel.ShortTitle;
            parameters[55].Value = shortInfoModel.ShortContent;
            parameters[56].Value = shortInfoModel.Remark;
            parameters[64].Value = merchantInfoModel.Merchanreturns;
            int  rowsAffected;
            long infoID;

            using (SqlConnection sqlConn = DbHelperSQL.GetSqlConnection())
            {
                sqlConn.Open();
                SqlTransaction sqlTran = sqlConn.BeginTransaction();
                try
                {
                    //插入招商资源信息插如方法
                    DbHelperSQL.RunProcedure(sqlConn, sqlTran, SP_MarchantInfo_Insert, parameters, out rowsAffected);
                    infoID = (long)parameters[0].Value;
                    if (infoID < 0)
                    {
                        throw new Exception();
                    }

                    //注释掉多个联系人
                    //if (infoContactManModels != null)
                    //{
                    //    //为招商资源添加多个联系人
                    //    Tz888.SQLServerDAL.Info.InfoContactManDAL obj1 = new InfoContactManDAL();
                    //    foreach (Tz888.Model.Info.InfoContactManModel model in infoContactManModels)
                    //    {
                    //        model.InfoID = infoID;
                    //        obj1.InsertContactMan(sqlConn, sqlTran, model);
                    //    }
                    //}

                    if (infoResourceModels != null)
                    {
                        //为招商信息添加多个资源
                        Tz888.SQLServerDAL.Info.InfoResourceDAL obj2 = new InfoResourceDAL();
                        foreach (Tz888.Model.Info.InfoResourceModel model in infoResourceModels)
                        {
                            model.InfoID = infoID;
                            obj2.InsertInfoResource(sqlConn, sqlTran, model);
                        }
                    }

                    sqlTran.Commit();
                }
                catch
                {
                    sqlTran.Rollback();
                    infoID = -1;
                }
                finally
                {
                    sqlConn.Close();
                }
            }

            return(infoID);
        }