/// <summary>
 /// 获取作者Model
 /// </summary>
 /// <param name="AuthorID"></param>
 /// <returns></returns>
 private AuthorDetailEntity GetModel(Int64 AuthorID)
 {
     AuthorDetailEntity model = null;
     if (AuthorID > 0)
     {
         AuthorDetailQuery query = new AuthorDetailQuery();
         query.JournalID = CurAuthor.JournalID;
         query.AuthorID = AuthorID;
         IAuthorPlatformFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorPlatformFacadeService>();
         model = service.GetAuthorDetailModel(query);
     }
     if (model == null)
         model = new AuthorDetailEntity();
     IAuthorFacadeService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorFacadeService>();
     var list = authorService.GetFieldsSet();
     if (list == null)
         list = new List<FieldsSet>();
     list.Insert(0, new FieldsSet { DisplayName = "中文姓名", FieldName = "中文姓名", DBField = "AuthorName", IsShow = true, IsRequire = true });
     model.FieldList = list.Where(p => p.IsShow).ToList();
     if (model.AuthorModel == null)
         model.AuthorModel = new AuthorInfoEntity();
     if (model.ExpertGroupList == null)
         model.ExpertGroupList = new List<ExpertGroupMapEntity>();
     return model;
 }
 public ActionResult Save(AuthorDetailEntity model)
 {
     IAuthorPlatformFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorPlatformFacadeService>();
     model.JournalID = CurAuthor.JournalID;
     ExecResult result = service.SaveAuthorDetail(model);
     return Json(new { result = result.result, msg = result.msg });
 }
 /// <summary>
 /// 作者完善个人信息
 /// </summary>
 /// <returns></returns>
 public ActionResult UpdateSelf()
 {
     AuthorDetailEntity model = new AuthorDetailEntity ();
     if(CurAuthor.OldGroupID==1)
         model = GetEditorModel(CurAuthor.AuthorID);
     else
         model = GetModel(CurAuthor.AuthorID);
     model.Emial = CurAuthor.LoginName;
     return View(model);
 }
        public bool DeleteAuthorDetail(AuthorDetailEntity authorDetailEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("DELETE FROM dbo.AuthorDetail");
            sqlCommandText.Append(" WHERE  PKID=@PKID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@PKID", DbType.Int64, authorDetailEntity.PKID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
 /// <summary>
 /// 保存作者详细信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult SaveAuthorDetail(AuthorDetailEntity model)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.PostAuth<ExecResult, AuthorDetailEntity>(GetAPIUrl(APIConstant.AUTHORDETAIL_SAVE), model);
     return result;
 }
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="authorDetail">AuthorDetailEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddAuthorDetail(AuthorDetailEntity authorDetail)
 {
     return AuthorDetailDataAccess.Instance.AddAuthorDetail(authorDetail);
 }
 public ExecResult Save(AuthorDetailEntity model)
 {
     try
     {
         IAuthorDetailService service = ServiceContainer.Instance.Container.Resolve<IAuthorDetailService>();
         return service.Save(model);
     }
     catch (Exception ex)
     {
         LogProvider.Instance.Error("保存用户信息失败:" + ex.ToString());
         ExecResult result = new ExecResult();
         result.result = EnumJsonResult.failure.ToString();
         result.msg = ex.Message;
         return result;
     }
 }
        public bool UpdateAuthorDetail(AuthorDetailEntity authorDetailEntity, DbTransaction trans = null)
        {
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  PKID=@PKID");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" AuthorName=@AuthorName");
            sqlCommandText.Append(", EnglishName=@EnglishName");
            sqlCommandText.Append(", Gender=@Gender");
            sqlCommandText.Append(", Nation=@Nation");
            sqlCommandText.Append(", Birthday=@Birthday");
            sqlCommandText.Append(", NativePlace=@NativePlace");
            sqlCommandText.Append(", Province=@Province");
            sqlCommandText.Append(", City=@City");
            sqlCommandText.Append(", Area=@Area");
            sqlCommandText.Append(", IDCard=@IDCard");
            sqlCommandText.Append(", Address=@Address");
            sqlCommandText.Append(", ZipCode=@ZipCode");
            sqlCommandText.Append(", Mobile=@Mobile");
            sqlCommandText.Append(", Tel=@Tel");
            sqlCommandText.Append(", Fax=@Fax");
            sqlCommandText.Append(", Education=@Education");
            sqlCommandText.Append(", Professional=@Professional");
            sqlCommandText.Append(", JobTitle=@JobTitle");
            sqlCommandText.Append(", Job=@Job");
            sqlCommandText.Append(", ResearchTopics=@ResearchTopics");
            sqlCommandText.Append(", WorkUnit=@WorkUnit");
            sqlCommandText.Append(", WorkUnitLevel=@WorkUnitLevel");
            sqlCommandText.Append(", SectionOffice=@SectionOffice");
            sqlCommandText.Append(", InvoiceUnit=@InvoiceUnit");
            sqlCommandText.Append(", Mentor=@Mentor");
            sqlCommandText.Append(", Remark=@Remark");
            sqlCommandText.Append(", QQ=@QQ");
            sqlCommandText.Append(", MSN=@MSN");
            sqlCommandText.Append(", AuthorOpus=@AuthorOpus");
            sqlCommandText.Append(", ReserveField=@ReserveField");
            sqlCommandText.Append(", ReserveField1=@ReserveField1");
            sqlCommandText.Append(", ReserveField2=@ReserveField2");
            sqlCommandText.Append(", ReserveField3=@ReserveField3");
            sqlCommandText.Append(", ReserveField4=@ReserveField4");
            sqlCommandText.Append(", ReserveField5=@ReserveField5");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.AuthorDetail SET {0} WHERE  {1}", sqlCommandText.ToString(), whereCommandText.ToString()));

            db.AddInParameter(cmd, "@PKID", DbType.Int64, authorDetailEntity.PKID);
            db.AddInParameter(cmd, "@AuthorName", DbType.AnsiString, authorDetailEntity.AuthorName);
            db.AddInParameter(cmd, "@EnglishName", DbType.AnsiString, authorDetailEntity.EnglishName);
            db.AddInParameter(cmd, "@Gender", DbType.AnsiString, authorDetailEntity.Gender);
            db.AddInParameter(cmd, "@Nation", DbType.AnsiString, authorDetailEntity.Nation);
            db.AddInParameter(cmd, "@Birthday", DbType.DateTime, authorDetailEntity.Birthday);
            db.AddInParameter(cmd, "@NativePlace", DbType.AnsiString, authorDetailEntity.NativePlace);
            db.AddInParameter(cmd, "@Province", DbType.AnsiString, authorDetailEntity.Province);
            db.AddInParameter(cmd, "@City", DbType.AnsiString, authorDetailEntity.City);
            db.AddInParameter(cmd, "@Area", DbType.AnsiString, authorDetailEntity.Area);
            db.AddInParameter(cmd, "@IDCard", DbType.AnsiString, authorDetailEntity.IDCard);
            db.AddInParameter(cmd, "@Address", DbType.AnsiString, authorDetailEntity.Address);
            db.AddInParameter(cmd, "@ZipCode", DbType.AnsiString, authorDetailEntity.ZipCode);
            db.AddInParameter(cmd, "@Mobile", DbType.AnsiString, authorDetailEntity.Mobile);
            db.AddInParameter(cmd, "@Tel", DbType.AnsiString, authorDetailEntity.Tel);
            db.AddInParameter(cmd, "@Fax", DbType.AnsiString, authorDetailEntity.Fax);
            db.AddInParameter(cmd, "@Education", DbType.AnsiString, authorDetailEntity.Education);
            db.AddInParameter(cmd, "@Professional", DbType.AnsiString, authorDetailEntity.Professional);
            db.AddInParameter(cmd, "@JobTitle", DbType.AnsiString, authorDetailEntity.JobTitle);
            db.AddInParameter(cmd, "@Job", DbType.AnsiString, authorDetailEntity.Job);
            db.AddInParameter(cmd, "@ResearchTopics", DbType.AnsiString, authorDetailEntity.ResearchTopics);
            db.AddInParameter(cmd, "@WorkUnit", DbType.AnsiString, authorDetailEntity.WorkUnit);
            db.AddInParameter(cmd, "@WorkUnitLevel", DbType.Int32, authorDetailEntity.WorkUnitLevel);
            db.AddInParameter(cmd, "@SectionOffice", DbType.AnsiString, authorDetailEntity.SectionOffice);
            db.AddInParameter(cmd, "@InvoiceUnit", DbType.AnsiString, authorDetailEntity.InvoiceUnit);
            db.AddInParameter(cmd, "@Mentor", DbType.AnsiString, authorDetailEntity.Mentor);
            db.AddInParameter(cmd, "@Remark", DbType.AnsiString, authorDetailEntity.Remark);
            db.AddInParameter(cmd, "@QQ", DbType.AnsiString, authorDetailEntity.QQ);
            db.AddInParameter(cmd, "@MSN", DbType.AnsiString, authorDetailEntity.MSN);
            db.AddInParameter(cmd, "@AuthorOpus", DbType.AnsiString, authorDetailEntity.AuthorOpus);
            db.AddInParameter(cmd, "@ReserveField", DbType.AnsiString, authorDetailEntity.ReserveField);
            db.AddInParameter(cmd, "@ReserveField1", DbType.AnsiString, authorDetailEntity.ReserveField1);
            db.AddInParameter(cmd, "@ReserveField2", DbType.AnsiString, authorDetailEntity.ReserveField2);
            db.AddInParameter(cmd, "@ReserveField3", DbType.AnsiString, authorDetailEntity.ReserveField3);
            db.AddInParameter(cmd, "@ReserveField4", DbType.AnsiString, authorDetailEntity.ReserveField4);
            db.AddInParameter(cmd, "@ReserveField5", DbType.AnsiString, authorDetailEntity.ReserveField5);

            try
            {
                bool result = false;
                if (trans == null)
                    result = db.ExecuteNonQuery(cmd) > 0;
                else
                    result = db.ExecuteNonQuery(cmd, trans) > 0;
                if (!result)
                    throw new Exception("编辑作者详细信息失败!");
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="authorDetail">AuthorDetailEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteAuthorDetail(AuthorDetailEntity authorDetail)
 {
     return AuthorDetailBusProvider.DeleteAuthorDetail(authorDetail);
 }
 public List<AuthorDetailEntity> MakeAuthorDetailList(IDataReader dr)
 {
     List<AuthorDetailEntity> list = new List<AuthorDetailEntity>();
     while (dr.Read())
     {
         AuthorDetailEntity authorDetailEntity = new AuthorDetailEntity();
         authorDetailEntity.PKID = dr.GetDrValue<Int64>("PKID");
         if (dr.HasColumn("bAuthorID"))
         {
             authorDetailEntity.AuthorID = dr.GetDrValue<Int64>("bAuthorID");
         }
         if (dr.HasColumn("bJournalID"))
         {
             authorDetailEntity.JournalID = dr.GetDrValue<Int64>("bJournalID");
         }
         authorDetailEntity.AuthorName = dr.GetDrValue<String>("AuthorName");
         authorDetailEntity.EnglishName = dr.GetDrValue<String>("EnglishName");
         authorDetailEntity.Gender = dr.GetDrValue<String>("Gender");
         authorDetailEntity.Nation = dr.GetDrValue<String>("Nation");
         authorDetailEntity.Birthday = dr.GetDrValue<DateTime?>("Birthday");
         authorDetailEntity.NativePlace = dr.GetDrValue<String>("NativePlace");
         authorDetailEntity.Province = dr.GetDrValue<String>("Province");
         authorDetailEntity.City = dr.GetDrValue<String>("City");
         authorDetailEntity.Area = dr.GetDrValue<String>("Area");
         authorDetailEntity.IDCard = "'"+dr.GetDrValue<String>("IDCard")+"'";
         authorDetailEntity.Address = dr.GetDrValue<String>("Address");
         authorDetailEntity.ZipCode = dr.GetDrValue<String>("ZipCode");
         authorDetailEntity.Mobile = dr.GetDrValue<String>("Mobile");
         authorDetailEntity.Tel = dr.GetDrValue<String>("Tel");
         authorDetailEntity.Fax = dr.GetDrValue<String>("Fax");
         authorDetailEntity.Education = dr.GetDrValue<Int32>("Education");
         authorDetailEntity.Professional = dr.GetDrValue<String>("Professional");
         authorDetailEntity.JobTitle = dr.GetDrValue<Int32>("JobTitle");
         authorDetailEntity.Job = dr.GetDrValue<String>("Job");
         authorDetailEntity.ResearchTopics = dr.GetDrValue<String>("ResearchTopics");
         authorDetailEntity.WorkUnit = dr.GetDrValue<String>("WorkUnit");
         authorDetailEntity.WorkUnitLevel = dr.GetDrValue<Int32>("WorkUnitLevel");
         authorDetailEntity.SectionOffice = dr.GetDrValue<String>("SectionOffice");
         authorDetailEntity.InvoiceUnit = dr.GetDrValue<String>("InvoiceUnit");
         authorDetailEntity.Mentor = dr.GetDrValue<String>("Mentor");
         authorDetailEntity.Remark = dr.GetDrValue<String>("Remark");
         authorDetailEntity.AuthorOpus = dr.GetDrValue<String>("AuthorOpus");
         authorDetailEntity.QQ = dr.GetDrValue<String>("QQ");
         authorDetailEntity.MSN = dr.GetDrValue<String>("MSN");
         authorDetailEntity.ReserveField = dr.GetDrValue<String>("ReserveField");
         authorDetailEntity.ReserveField1 = dr.GetDrValue<String>("ReserveField1");
         authorDetailEntity.ReserveField2 = dr.GetDrValue<String>("ReserveField2");
         authorDetailEntity.ReserveField3 = dr.GetDrValue<String>("ReserveField3");
         authorDetailEntity.ReserveField4 = dr.GetDrValue<String>("ReserveField4");
         authorDetailEntity.ReserveField5 = dr.GetDrValue<String>("ReserveField5");
         if (dr.HasColumn("bAddDate"))
         {
             authorDetailEntity.AddDate = dr.GetDrValue<DateTime>("bAddDate");
         }
         authorDetailEntity.AuthorModel = MakeAuthorInfo(dr);
         authorDetailEntity.AuthorName = authorDetailEntity.AuthorModel.RealName;
         list.Add(authorDetailEntity);
     }
     dr.Close();
     return list;
 }
        /// <summary>
        /// 保存作者信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SaveAuthor(AuthorDetailEntity model)
        {
            using (DbConnection conn = db.CreateConnection())
            {
                if (conn.State != ConnectionState.Open)
                    conn.Open();
                DbTransaction trans = conn.BeginTransaction();
                try
                {
                    if (model.PKID == 0)//新增
                    {
                        if (model.AuthorModel == null)
                            model.AuthorModel = new AuthorInfoEntity();
                        model.AuthorModel.Mobile = model.Mobile;
                        model.AuthorModel.RealName = model.AuthorName;
                        model.AuthorModel.JournalID = model.JournalID;
                        if (model.AuthorModel.AuthorID == 0)  //作者基本信息也不存在
                        {
                            //新增作者基本信息

                            Int64 AuthorID = AddAuthor(model.AuthorModel, trans);

                            if (AuthorID == 0)
                                throw new Exception();

                            model.AuthorID = AuthorID;
                        }
                        else
                        {
                            if (!string.IsNullOrWhiteSpace(model.AuthorModel.LoginName))
                                UpdateAuthor(model.AuthorModel, trans);
                            model.AuthorID = model.AuthorModel.AuthorID;
                        }

                        //新增作者详细
                        AddAuthorDetail(model, trans);

                        //新增专家分组
                        if (model.AuthorModel.GroupID == 3)
                        {
                            if (model.ExpertGroupList != null && model.ExpertGroupList.Count > 0)
                            {
                                foreach (var item in model.ExpertGroupList)
                                {
                                    item.JournalID = model.JournalID;
                                    item.AuthorID = model.AuthorID;
                                    AddExpertGroupMap(item, trans);
                                }
                            }
                        }
                    }
                    else  //编辑
                    {
                        UpdateAuthorDetail(model, trans);
                        UpdateAuthor(model.AuthorName, model.Mobile,model.AuthorID);

                        if (model.AuthorModel != null)
                        {
                            model.AuthorModel.JournalID = model.JournalID;
                            model.AuthorModel.AuthorID = model.AuthorID;
                            model.AuthorModel.Mobile = model.Mobile;
                            model.AuthorModel.RealName = model.AuthorName;
                            if (!string.IsNullOrWhiteSpace(model.AuthorModel.LoginName))
                                UpdateAuthor(model.AuthorModel, trans);

                            if (model.AuthorModel.GroupID == 3 && model.ExpertGroupList != null)
                            {
                                DelExpertGroupMap(new Int64[] { model.AuthorID }, trans);
                                if (model.ExpertGroupList.Count > 0)
                                {
                                    foreach (var item in model.ExpertGroupList)
                                    {
                                        item.JournalID = model.JournalID;
                                        item.AuthorID = model.AuthorID;
                                        AddExpertGroupMap(item, trans);
                                    }
                                }
                            }
                        }
                        else
                        {
                            UpdateAuthorMobile(model, trans);
                        }

                    }

                    trans.Commit();

                    return true;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
            }
        }
        public bool AddAuthorDetail(AuthorDetailEntity authorDetailEntity, DbTransaction trans = null)
        {
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @AuthorID");
            sqlCommandText.Append(", @JournalID");
            sqlCommandText.Append(", @AuthorName");
            sqlCommandText.Append(", @EnglishName");
            sqlCommandText.Append(", @Gender");
            sqlCommandText.Append(", @Nation");
            sqlCommandText.Append(", @Birthday");
            sqlCommandText.Append(", @NativePlace");
            sqlCommandText.Append(", @Province");
            sqlCommandText.Append(", @City");
            sqlCommandText.Append(", @Area");
            sqlCommandText.Append(", @IDCard");
            sqlCommandText.Append(", @Address");
            sqlCommandText.Append(", @ZipCode");
            sqlCommandText.Append(", @Mobile");
            sqlCommandText.Append(", @Tel");
            sqlCommandText.Append(", @Fax");
            sqlCommandText.Append(", @Education");
            sqlCommandText.Append(", @Professional");
            sqlCommandText.Append(", @JobTitle");
            sqlCommandText.Append(", @Job");
            sqlCommandText.Append(", @ResearchTopics");
            sqlCommandText.Append(", @WorkUnit");
            sqlCommandText.Append(", @WorkUnitLevel");
            sqlCommandText.Append(", @SectionOffice");
            sqlCommandText.Append(", @InvoiceUnit");
            sqlCommandText.Append(", @Mentor");
            sqlCommandText.Append(", @Remark");
            sqlCommandText.Append(", @QQ");
            sqlCommandText.Append(", @MSN");
            sqlCommandText.Append(", @AuthorOpus");
            sqlCommandText.Append(", @ReserveField");
            sqlCommandText.Append(", @ReserveField1");
            sqlCommandText.Append(", @ReserveField2");
            sqlCommandText.Append(", @ReserveField3");
            sqlCommandText.Append(", @ReserveField4");
            sqlCommandText.Append(", @ReserveField5");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.AuthorDetail ({0}) VALUES ({1})", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@AuthorID", DbType.Int64, authorDetailEntity.AuthorID);
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, authorDetailEntity.JournalID);
            db.AddInParameter(cmd, "@AuthorName", DbType.AnsiString, authorDetailEntity.AuthorName);
            db.AddInParameter(cmd, "@EnglishName", DbType.AnsiString, authorDetailEntity.EnglishName);
            db.AddInParameter(cmd, "@Gender", DbType.AnsiString, authorDetailEntity.Gender);
            db.AddInParameter(cmd, "@Nation", DbType.AnsiString, authorDetailEntity.Nation);
            db.AddInParameter(cmd, "@Birthday", DbType.DateTime, authorDetailEntity.Birthday);
            db.AddInParameter(cmd, "@NativePlace", DbType.AnsiString, authorDetailEntity.NativePlace);
            db.AddInParameter(cmd, "@Province", DbType.AnsiString, authorDetailEntity.Province);
            db.AddInParameter(cmd, "@City", DbType.AnsiString, authorDetailEntity.City);
            db.AddInParameter(cmd, "@Area", DbType.AnsiString, authorDetailEntity.Area);
            db.AddInParameter(cmd, "@IDCard", DbType.AnsiString, authorDetailEntity.IDCard);
            db.AddInParameter(cmd, "@Address", DbType.AnsiString, authorDetailEntity.Address);
            db.AddInParameter(cmd, "@ZipCode", DbType.AnsiString, authorDetailEntity.ZipCode);
            db.AddInParameter(cmd, "@Mobile", DbType.AnsiString, authorDetailEntity.Mobile);
            db.AddInParameter(cmd, "@Tel", DbType.AnsiString, authorDetailEntity.Tel);
            db.AddInParameter(cmd, "@Fax", DbType.AnsiString, authorDetailEntity.Fax);
            db.AddInParameter(cmd, "@Education", DbType.AnsiString, authorDetailEntity.Education);
            db.AddInParameter(cmd, "@Professional", DbType.AnsiString, authorDetailEntity.Professional);
            db.AddInParameter(cmd, "@JobTitle", DbType.AnsiString, authorDetailEntity.JobTitle);
            db.AddInParameter(cmd, "@Job", DbType.AnsiString, authorDetailEntity.Job);
            db.AddInParameter(cmd, "@ResearchTopics", DbType.AnsiString, authorDetailEntity.ResearchTopics);
            db.AddInParameter(cmd, "@WorkUnit", DbType.AnsiString, authorDetailEntity.WorkUnit);
            db.AddInParameter(cmd, "@WorkUnitLevel", DbType.Int32, authorDetailEntity.WorkUnitLevel);
            db.AddInParameter(cmd, "@SectionOffice", DbType.AnsiString, authorDetailEntity.SectionOffice);
            db.AddInParameter(cmd, "@InvoiceUnit", DbType.AnsiString, authorDetailEntity.InvoiceUnit);
            db.AddInParameter(cmd, "@Mentor", DbType.AnsiString, authorDetailEntity.Mentor);
            db.AddInParameter(cmd, "@Remark", DbType.AnsiString, authorDetailEntity.Remark);
            db.AddInParameter(cmd, "@QQ", DbType.AnsiString, authorDetailEntity.QQ);
            db.AddInParameter(cmd, "@MSN", DbType.AnsiString, authorDetailEntity.MSN);
            db.AddInParameter(cmd, "@AuthorOpus", DbType.String, authorDetailEntity.AuthorOpus);
            db.AddInParameter(cmd, "@ReserveField", DbType.AnsiString, authorDetailEntity.ReserveField);
            db.AddInParameter(cmd, "@ReserveField1", DbType.AnsiString, authorDetailEntity.ReserveField1);
            db.AddInParameter(cmd, "@ReserveField2", DbType.AnsiString, authorDetailEntity.ReserveField2);
            db.AddInParameter(cmd, "@ReserveField3", DbType.AnsiString, authorDetailEntity.ReserveField3);
            db.AddInParameter(cmd, "@ReserveField4", DbType.AnsiString, authorDetailEntity.ReserveField4);
            db.AddInParameter(cmd, "@ReserveField5", DbType.AnsiString, authorDetailEntity.ReserveField5);

            try
            {
                bool result = false;
                if (trans == null)
                    result = db.ExecuteNonQuery(cmd) > 0;
                else
                    result = db.ExecuteNonQuery(cmd, trans) > 0;
                if (!result)
                    throw new Exception("新增作者详细信息失败!");
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public AuthorDetailEntity MakeAuthorDetail(DataRow dr)
 {
     AuthorDetailEntity authorDetailEntity = null;
     if (dr != null)
     {
         authorDetailEntity = new AuthorDetailEntity();
         authorDetailEntity.PKID = (Int64)dr["PKID"];
         authorDetailEntity.AuthorID = (Int64)dr["AuthorID"];
         authorDetailEntity.JournalID = (Int64)dr["JournalID"];
         authorDetailEntity.AuthorName = (String)dr["AuthorName"];
         authorDetailEntity.EnglishName = (String)dr["EnglishName"];
         authorDetailEntity.Gender = (String)dr["Gender"];
         authorDetailEntity.Nation = (String)dr["Nation"];
         authorDetailEntity.Birthday = Convert.IsDBNull(dr["Birthday"]) ? null : (DateTime?)dr["Birthday"];
         authorDetailEntity.NativePlace = (String)dr["NativePlace"];
         authorDetailEntity.IDCard = "'"+(String)dr["IDCard"]+"'";
         authorDetailEntity.Address = (String)dr["Address"];
         authorDetailEntity.ZipCode = (String)dr["ZipCode"];
         authorDetailEntity.Mobile = (String)dr["Mobile"];
         authorDetailEntity.Tel = (String)dr["Tel"];
         authorDetailEntity.Fax = (String)dr["Fax"];
         authorDetailEntity.Education = (Int32)dr["Education"];
         authorDetailEntity.Professional = (String)dr["Professional"];
         authorDetailEntity.JobTitle = (Int32)dr["JobTitle"];
         authorDetailEntity.Job = (String)dr["Job"];
         authorDetailEntity.ResearchTopics = (String)dr["ResearchTopics"];
         authorDetailEntity.WorkUnit = (String)dr["WorkUnit"];
         authorDetailEntity.WorkUnitLevel = (Int32)dr["WorkUnitLevel"];
         authorDetailEntity.SectionOffice = (String)dr["SectionOffice"];
         authorDetailEntity.InvoiceUnit = (String)dr["InvoiceUnit"];
         authorDetailEntity.Mentor = (String)dr["Mentor"];
         authorDetailEntity.Remark = (String)dr["Remark"];
         authorDetailEntity.AuthorOpus = (String)dr["AuthorOpus"];
         authorDetailEntity.QQ = (String)dr["QQ"];
         authorDetailEntity.MSN = (String)dr["MSN"];
         authorDetailEntity.ReserveField = Convert.IsDBNull(dr["ReserveField"]) ? null : (String)dr["ReserveField"];
         authorDetailEntity.ReserveField1 = Convert.IsDBNull(dr["ReserveField1"]) ? null : (String)dr["ReserveField1"];
         authorDetailEntity.ReserveField2 = Convert.IsDBNull(dr["ReserveField2"]) ? null : (String)dr["ReserveField2"];
         authorDetailEntity.ReserveField3 = Convert.IsDBNull(dr["ReserveField3"]) ? null : (String)dr["ReserveField3"];
         authorDetailEntity.ReserveField4 = Convert.IsDBNull(dr["ReserveField4"]) ? null : (String)dr["ReserveField4"];
         authorDetailEntity.ReserveField5 = Convert.IsDBNull(dr["ReserveField5"]) ? null : (String)dr["ReserveField5"];
         authorDetailEntity.AddDate = (DateTime)dr["AddDate"];
     }
     return authorDetailEntity;
 }
        /// <summary>
        /// 获取专家分组信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public IList<AuthorDetailEntity> GetExpertGroupMapList(ExpertGroupMapEntity query)
        {
            string strSql = @"    select a.AuthorID,a.LoginName,a.RealName,c.PKID   from
            (SELECT b.AuthorID ,b.LoginName ,b.RealName,B.JournalID FROM dbo.AuthorDetail a with(nolock)
                              RIGHT JOIN dbo.AuthorInfo b with(nolock) ON a.JournalID=b.JournalID and a.AuthorID=b.AuthorID WHERE  b.JournalID=" + query.JournalID + " and (b.GroupID=3 or exists(select 1 from dbo.RoleAuthor m with(nolock) WHERE b.JournalID=m.JournalID and b.AuthorID=m.AuthorID and m.RoleID=3))) as A LEFT JOIN dbo.ExpertGroupMap c  ON   A.JournalID=c.JournalID and a.AuthorID=c.AuthorID and c.ExpertGroupID=" + query.ExpertGroupID + "  ORDER BY RealName";

            return db.GetList<AuthorDetailEntity>(strSql, (dr) =>
            {
                List<AuthorDetailEntity> list = new List<AuthorDetailEntity>();
                AuthorDetailEntity model = null;
                while (dr.Read())
                {
                    model = new AuthorDetailEntity();
                    model.AuthorID = dr.GetDrValue<Int64>("AuthorID");
                    model.Emial = dr.GetDrValue<String>("LoginName");
                    model.AuthorName = dr.GetDrValue<String>("RealName");
                    model.IsChecked = dr.GetDrValue<Int64>("PKID") > 0;
                    list.Add(model);
                }
                return list;
            });
        }
示例#15
0
        /// <summary>
        /// 获取审稿单内容
        /// </summary>
        /// <param name="CID"></param>
        /// <param name="ExpertID"></param>
        /// <returns></returns>
        private string GetReviewBillContent(Int64 CID, Int64 EditorID, Int64 ExpertID, Int64 FlowLogID)
        {
            StringBuilder strHtml = new StringBuilder();
            strHtml.AppendFormat(" <div style=\"text-align: center; font-family: 黑体; font-size: 16px; padding-bottom: 15px;\">《{0}》 审稿单</div>",
                SiteConfig.SiteName);

            #region 获取稿件信息
            ContributionInfoQuery query = new ContributionInfoQuery();
            query.JournalID = CurAuthor.JournalID;
            query.IsAuxiliary = false;
            query.CID = CID;
            IAuthorPlatformFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorPlatformFacadeService>();
            var CModel = service.GetContributionInfoModel(query);
            if (CModel == null)
                CModel = new ContributionInfoEntity();
            #endregion

            #region 获取作者信息
            AuthorDetailQuery query1 = new AuthorDetailQuery();
            query1.JournalID = CurAuthor.JournalID;
            query1.AuthorIDs = new Int64[] { CModel.AuthorID, ExpertID };
            var listAuthor = service.GetAuthorDetailList(query1).ToList();
            var AModel = listAuthor.Find(p => p.AuthorID == CModel.AuthorID);
            var EModel = listAuthor.Find(p => p.AuthorID == ExpertID);
            if (AModel == null)
                AModel = new AuthorDetailEntity();
            if (EModel == null)
                EModel = new AuthorDetailEntity();

            ISiteConfigFacadeService service1 = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
            DictValueQuery query2 = new DictValueQuery();
            query2.JournalID = SiteConfig.SiteID;
            query2.DictKey = EnumDictKey.JobTitle.ToString();
            IDictionary<int, string> dict = service1.GetDictValueDcit(query2);
            string jobTitle = dict.ContainsKey(EModel.JobTitle) ? dict[EModel.JobTitle] : string.Empty;
            #endregion

            #region 获取审稿日志
            IFlowFacadeService flowService = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>();
            CirculationEntity cirEntity = new CirculationEntity();
            cirEntity.CID = CID;
            cirEntity.JournalID = JournalID;
            cirEntity.GroupID = 1;
            IList<FlowLogInfoEntity> flowLogList = flowService.GetFlowLog(cirEntity);

            FlowLogInfoEntity LogSendModel = flowLogList.ToList().Find(p => p.FlowLogID == FlowLogID);

            //var LogModel = flowLogList.ToList().Where(p => p.SendUserID == ExpertID).FirstOrDefault(q => q.TargetStatusID == LogSendModel.TargetStatusID);
            var LogModel = flowLogList.ToList().Find(p => p.SendUserID == EditorID);
            if (LogModel == null)
                LogModel = new FlowLogInfoEntity();
            if (LogSendModel == null)
                LogSendModel = new FlowLogInfoEntity();
            #endregion

            strHtml.Append(flowService.GetReviewBillContentHead(CurAuthor.JournalID, ExpertID, CID));
            strHtml.AppendFormat("<div style=\"padding: 0px 0px 5px 0px; font-size: 11pt; font-family: Times New Roman;\">稿件编号:{0}</div>"
                , CModel.CNumber);
            strHtml.Append("<table border=\"0\" class=\"mainTable\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\">");
            strHtml.AppendFormat("<tr><td class=\"left\">稿件标题:</td><td class=\"right\" style=\"font-weight: bolder;\" colspan=\"3\">{0}</td></tr>"
                , CModel.Title);

            strHtml.AppendFormat("<tr><td class=\"left\">送审日期:</td><td class=\"right\">{0}</td><td class=\"left_m\">审毕日期:</td><td class=\"right\">{1}</td></tr>"
                , LogModel.AddDate, LogModel.DealDate);
            strHtml.AppendFormat("<tr><td class=\"left\">作者姓名:</td><td class=\"right\">{0}</td><td class=\"left_m\">单位:</td><td class=\"right\">{1}</td></tr>"
                , AModel.AuthorName, AModel.WorkUnit);
            strHtml.AppendFormat("<tr><td class=\"left\" style=\"width: 80px;\">对本稿的总评价:</td><td class=\"right\" style=\"padding: 5px 0px 10px 5px;\" colspan=\"3\">");
            IFlowFacadeService service2 = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>();
            strHtml.Append(service2.GetReviewBillContentStr(CurAuthor.JournalID, ExpertID, CID));
            strHtml.Append("</td></tr>");
            strHtml.Append("<tr><td class=\"left\" style=\"width: 80px;\">审稿意见:</td><td class=\"right\" style=\"padding: 5px 0px 10px 5px;\" colspan=\"3\">");
            strHtml.Append(LogSendModel.DealAdvice);
            strHtml.Append("</td></tr>");

            strHtml.AppendFormat("<tr><td class=\"left\">审稿人姓名:</td><td class=\"right\">{0}</td><td class=\"left_m\">身份证号:</td><td class=\"right\">{1}</td></tr>"
              , EModel.AuthorName, EModel.IDCard);
            strHtml.AppendFormat("<tr><td class=\"left\">联系电话:</td><td class=\"right\">{0}</td><td class=\"left_m\">Email:</td><td class=\"right\">{1}</td></tr>"
                , EModel.Mobile, EModel.AuthorModel.LoginName);
            strHtml.AppendFormat("<tr><td class=\"left\">通讯地址:</td><td class=\"right\">{0}</td><td class=\"left_m\">邮政编码:</td><td class=\"right\">{1}</td></tr>"
               , EModel.Address, EModel.ZipCode);
            strHtml.AppendFormat("<tr><td class=\"left\">研究方向:</td><td class=\"right\">{0}</td><td class=\"left_m\">职称:</td><td class=\"right\">{1}</td></tr>"
            , EModel.ResearchTopics, jobTitle);
            strHtml.Append("</table>");
            return strHtml.ToString();
        }
示例#16
0
 /// <summary>
 /// 保存作者详细信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult Save(AuthorDetailEntity model)
 {
     ExecResult execResult = new ExecResult();
     bool result = false;
     model.AuthorName = model.AuthorName.TextFilter();
     model.EnglishName = model.EnglishName.TextFilter();
     model.Nation = model.Nation.TextFilter();
     model.NativePlace = model.NativePlace.TextFilter();
     model.Province = model.Province.TextFilter();
     model.City = model.City.TextFilter();
     model.Area = model.Area.TextFilter();
     model.IDCard = model.IDCard.TextFilter();
     model.Address = model.Address.TextFilter();
     model.ZipCode = model.ZipCode.TextFilter();
     model.Mobile = model.Mobile.TextFilter();
     model.Tel = model.Tel.TextFilter();
     model.Fax = model.Fax.TextFilter();
     model.Professional = model.Professional.TextFilter();
     model.Job = model.Job.TextFilter();
     model.ResearchTopics = model.ResearchTopics.TextFilter();
     model.WorkUnit = model.WorkUnit.TextFilter();
     model.SectionOffice = model.SectionOffice.TextFilter();
     model.Mentor = model.Mentor.TextFilter();
     model.QQ = model.QQ.TextFilter();
     model.MSN = model.MSN.TextFilter();
     model.Remark = model.Remark.TextFilter();
     model.ReserveField = model.ReserveField.TextFilter();
     model.ReserveField1 = model.ReserveField1.TextFilter();
     model.ReserveField2 = model.ReserveField2.TextFilter();
     model.ReserveField3 = model.ReserveField3.TextFilter();
     model.ReserveField4 = model.ReserveField4.TextFilter();
     model.ReserveField5 = model.ReserveField5.TextFilter();
     if (model.AuthorModel != null&&!string.IsNullOrWhiteSpace(model.AuthorModel.Pwd))
         model.AuthorModel.Pwd = WKT.Common.Security.MD5Handle.Encrypt(model.AuthorModel.Pwd);
     result = AuthorDetailBusProvider.SaveAuthor(model);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "保存用户详细信息成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "保存用户详细信息失败!";
     }
     return execResult;
 }
示例#17
0
 /// <summary>
 /// 保存作者信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool SaveAuthor(AuthorDetailEntity model)
 {
     return AuthorDetailDataAccess.Instance.SaveAuthor(model);
 }
示例#18
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="authorDetail">AuthorDetailEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateAuthorDetail(AuthorDetailEntity authorDetail)
 {
     return AuthorDetailBusProvider.UpdateAuthorDetail(authorDetail);
 }
示例#19
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="authorDetail">AuthorDetailEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteAuthorDetail(AuthorDetailEntity authorDetail)
 {
     return AuthorDetailDataAccess.Instance.DeleteAuthorDetail(authorDetail);
 }
示例#20
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="authorDetail">AuthorDetailEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddAuthorDetail(AuthorDetailEntity authorDetail)
 {
     return AuthorDetailBusProvider.AddAuthorDetail(authorDetail);
 }
 /// <summary>
 /// 获取编辑为作者投稿时 所选择的作者详细信息
 /// </summary>
 /// <returns></returns>
 private AuthorDetailEntity GetAuthorDetailModel(Int64 authorID)
 {
     IAuthorPlatformFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorPlatformFacadeService>();
     var model = service.GetAuthorDetailModel(new AuthorDetailQuery() { JournalID = CurAuthor.JournalID, AuthorID = authorID });
     if (model == null)
         model = new AuthorDetailEntity();
     return model;
 }
 /// <summary>
 /// 修改作者信息表手机信息
 /// </summary>
 /// <param name="model"></param>
 /// <param name="trans"></param>
 /// <returns></returns>
 private bool UpdateAuthorMobile(AuthorDetailEntity model, DbTransaction trans)
 {
     DbCommand cmd = db.GetSqlStringCommand("UPDATE dbo.AuthorInfo set Mobile=@Mobile,RealName=@RealName WHERE AuthorID=@AuthorID");
     db.AddInParameter(cmd, "@Mobile", DbType.AnsiString, model.Mobile);
     db.AddInParameter(cmd, "@RealName", DbType.AnsiString, model.AuthorName);
     db.AddInParameter(cmd, "@AuthorID", DbType.Int64, model.AuthorID);
     return db.ExecuteNonQuery(cmd, trans) > 0;
 }