Exemplo n.º 1
0
        public ActionResult ArticleEdit(int id)//此处id表示ArticleID
        {
            HttpCookie cookie = Request.Cookies["Employer"];

            if (cookie != null)
            {
                string    EmployerAccount = cookie.Values["EmployerAccount"];
                DataTable temparticle     = TempArticle.GetTempArticleByArticleID(id, EmployerAccount);
                if (temparticle.Rows.Count > 0)//该文章已经被编辑过,存在于TempArticle里面
                {
                    //重定向TempArticleEdit
                    return(RedirectToAction("TempArticleEdit", new { id = temparticle.Rows[0]["TempArticleID"] }));
                }
                else
                {
                    ViewBag.flag = true;                                                                    //文章是否存在的标志
                    DataTable article = Article.GetArticleByArticleIDAndEditorAccount(id, EmployerAccount); //得到Article表文章
                    if (article != null && article.Rows.Count > 0)
                    {
                        ViewBag.Article = article;

                        //显示大型招聘会选项
                        int typeid = Convert.ToInt32(article.Rows[0]["TypeID"]);
                        ViewBag.typename = ArticleType.GetTypeNameByTypeID(typeid);
                        if (typeid == 1)//专场招聘
                        {
                            //获取时间和地点
                            ViewBag.PlaceList      = Article.GetPlaceListSecondById(Convert.ToInt32(article.Rows[0]["PlaceSecondID"]));
                            ViewBag.PlaceListFirst = Article.GetPlaceListFirst();
                        }
                        if (typeid == 2)//双选会
                        {
                            DataTable bigarticleTable2 = Article.SelectArticleFromArticle(2, DateTime.Now);
                            ViewBag.bigarticleTable2 = bigarticleTable2;
                            ViewBag.BigArticleID     = Article.GetBigArticleByArticleID(Convert.ToInt32(article.Rows[0]["ArticleID"]));
                        }
                        else if (typeid == 3)//组团招聘
                        {
                            DataTable bigarticleTable3 = Article.SelectArticleFromArticle(3, DateTime.Now);
                            ViewBag.bigarticleTable3 = bigarticleTable3;
                            ViewBag.BigArticleID     = Article.GetBigArticleByArticleID(Convert.ToInt32(article.Rows[0]["ArticleID"]));
                        }
                        //其他类型的文章不用管

                        //需求部分
                        ViewBag.DemandInfos = DemandInfo.GetDemandInfoByArticleID(id);
                    }
                    else
                    {
                        ViewBag.flag = false;
                    }                             //文章不存在
                }
            }
            else
            {
                ViewBag.flag = false;
            }                             //cookie不存在

            return(View());
        }
Exemplo n.º 2
0
 public DemandScalarDialog(App game, DemandType type, int otherPlayer, string template = "dialogRequestScalar")
     : base(game, template)
 {
     this._otherPlayer             = otherPlayer;
     this._type                    = type;
     this._demand                  = new DemandInfo();
     this._demand.InitiatingPlayer = game.LocalPlayer.ID;
     this._demand.ReceivingPlayer  = this._otherPlayer;
     this._demand.State            = AgreementState.Unrequested;
     this._demand.Type             = type;
 }
Exemplo n.º 3
0
 protected void finesSelectedChanged(object sender, EventArgs e)
 {
     // Get the currently selected row using the SelectedRow property.
     GridViewRow row = carFinesInfoList.SelectedRow;
     DemandInfo demandInfo = new DemandInfo();
     demandInfo.payTicketNo = row.Cells[2].Text.ToString();
     demandInfo.finesStyle = row.Cells[3].Text;
     demandInfo.finesMemoy = row.Cells[4].Text;
     demandInfo.dePoint = row.Cells[5].Text;
     demandInfo.carNo = carNo_label.Text;
     Session.Add("demandInfo", demandInfo);
     Response.Redirect("PayFinesWeb.aspx", true);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 确认上线
        /// </summary>
        /// <param name="objDemand"></param>
        /// <returns></returns>
        public int UpLineDemand(DemandInfo objDemand)
        {
            string sql = $"update DemandInfo set Publisher=@Publisher,ScheduleTime=@ScheduleTime,UpTime=@UpTime where DemandId=@DemandId";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@Publisher", objDemand.Publisher),
                new SqlParameter("@ScheduleTime", objDemand.ScheduleTime),
                new SqlParameter("@UpTime", objDemand.UpTime),
                new SqlParameter("@DemandId", objDemand.DemandId),
            };
            return(SQLHelper.Update(sql, paras));
        }
        public ActionResult ModifyDemandInfo(DemandInfo objDemand)
        {
            //DemandInfo objDemand = new DemandInfo()
            //{
            //    DemandId = Convert.ToInt32(Request.Params["DemandId"]),
            //    ProductId = Convert.ToInt32(Request.Params["ProductId"]),
            //    SubmissionDepartment = Request.Params["SubmissionDepartment"],
            //    RequirementDescription = Request.Params["RequirementDescription"],
            //    EmergencyId = Convert.ToInt32(Request.Params["EmergencyId"]),
            //    Modifier = Request.Params["Modifier"],
            //    ModificationTime = DateTime.Now
            //};
            objDemand.Modifier         = Convert.ToInt32(Session["UserId"]);
            objDemand.ModificationTime = DateTime.Now;
            if (string.IsNullOrEmpty(objDemand.SubmissionDepartment))
            {
                ViewBag.Mess = "请填写提交部门";
            }
            else if (string.IsNullOrEmpty(objDemand.RequirementDescription))
            {
                ViewBag.Mess = "请填写需求描述";
            }
            else
            {
                //调用业务逻辑
                int result = new BLL.DemandManager().ModifyDemandInfoByDemandId(objDemand);
                //保存数据
                if (result > 0)
                {
                    return(Content("<script>alert('修改成功!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
                }
                else
                {
                    return(Content("<script>alert('修改失败!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
                }
            }

            //if (string.IsNullOrEmpty(objDemand.SubmissionDepartment))
            //{
            //    ViewBag.Mess = "提交部门不能为空";
            //}
            //else if (string.IsNullOrEmpty(objDemand.RequirementDescription))
            //{
            //    ViewBag.Mess = "需求描述不能为空";
            //}
            //else
            //{

            //}
            return(View("ModifyDemandInfo"));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 认领需求
        /// </summary>
        /// <param name="objDemand"></param>
        /// <returns></returns>
        public int ConfirmDemand(DemandInfo objDemand)
        {
            string sql = $"update DemandInfo set PlanContent=@PlanContent,ExpectedOnlineTime=@ExpectedOnlineTime,ConfirmationPerson=@ConfirmationPerson,ConfirmTime=@ConfirmTime where DemandId=@DemandId";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@PlanContent", objDemand.PlanContent),
                new SqlParameter("@ExpectedOnlineTime", objDemand.ExpectedOnlineTime),
                new SqlParameter("@ConfirmationPerson", objDemand.ConfirmationPerson),
                new SqlParameter("@ConfirmTime", objDemand.ConfirmTime),
                new SqlParameter("@DemandId", objDemand.DemandId)
            };
            return(SQLHelper.Update(sql, paras));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 发布需求
        /// </summary>
        /// <param name="objDemand"></param>
        /// <returns></returns>
        public int AddDemandInfo(DemandInfo objDemand)
        {
            string sql = $"insert into DemandInfo(ProductId,SubmissionDepartment,RequirementDescription,EmergencyId,Founder,CreationTime) values(@ProductId,@SubmissionDepartment,@RequirementDescription,@EmergencyId,@Founder,@CreationTime)";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@ProductId", objDemand.ProductId),
                new SqlParameter("@SubmissionDepartment", objDemand.SubmissionDepartment),
                new SqlParameter("@RequirementDescription", objDemand.RequirementDescription),
                new SqlParameter("@EmergencyId", objDemand.EmergencyId),
                new SqlParameter("@Founder", objDemand.Founder),
                new SqlParameter("@CreationTime", objDemand.CreationTime)
            };
            return(SQLHelper.Update(sql, paras));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 根据需求详情ID编号修改需求
        /// </summary>
        /// <param name="objDemand"></param>
        /// <returns></returns>
        public int ModifyDemandInfoByDemandId(DemandInfo objDemand)
        {
            string sql = $"update DemandInfo set [ProductId]=@ProductId, [SubmissionDepartment]=@SubmissionDepartment, [RequirementDescription]=@RequirementDescription, [EmergencyId]=@EmergencyId,Modifier=@Modifier,ModificationTime=@ModificationTime where DemandId=@DemandId";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@ProductId", objDemand.ProductId),
                new SqlParameter("@SubmissionDepartment", objDemand.SubmissionDepartment),
                new SqlParameter("@RequirementDescription", objDemand.RequirementDescription),
                new SqlParameter("@EmergencyId", objDemand.EmergencyId),
                new SqlParameter("@Modifier", objDemand.Modifier),
                new SqlParameter("@ModificationTime", objDemand.ModificationTime),
                new SqlParameter("@DemandId", objDemand.DemandId)
            };
            return(SQLHelper.Update(sql, paras));
        }
        public ActionResult UpLineDemand(DemandInfo objDemand)
        {
            //获取数据
            objDemand.Publisher    = Convert.ToInt32(Session["UserId"]);
            objDemand.ScheduleTime = DateTime.Now;
            //调用业务逻辑
            int result = new BLL.DemandManager().UpLineDemand(objDemand);

            if (result > 0)
            {
                return(Content("<script>alert('确认成功!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
            }
            else
            {
                return(Content("<script>alert('确认失败!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
            }
        }
Exemplo n.º 10
0
 public DemandSystemSelectDialog(App game, DemandType type, int otherPlayer, string template = "dialogRequestSystemSelect")
     : base(game, template)
 {
     this._otherPlayer             = otherPlayer;
     this._type                    = type;
     this._demand                  = new DemandInfo();
     this._demand.InitiatingPlayer = game.LocalPlayer.ID;
     this._demand.ReceivingPlayer  = this._otherPlayer;
     this._demand.State            = AgreementState.Unrequested;
     this._demand.Type             = type;
     this._crits                   = new GameObjectSet(game);
     this._sky = new Sky(game, SkyUsage.StarMap, 0);
     this._crits.Add((IGameObject)this._sky);
     this._starmap = new StarMap(game, game.Game, this._sky);
     this._crits.Add((IGameObject)this._starmap);
     this._starmap.SetCamera(game.Game.StarMapCamera);
 }
Exemplo n.º 11
0
        public ActionResult PublishDemandInfo(DemandInfo objDemand)
        {
            //接收数据
            //DemandInfo objDemand = new DemandInfo()
            //{
            //    ProductId = Convert.ToInt32(Request.Params["ProductId"]),
            //    SubmissionDepartment = Request.Params["SubmissionDepartment"],
            //    RequirementDescription = Request.Params["RequirementDescription"],
            //    EmergencyId = Convert.ToInt32(Request["EmergencyId"]),
            //    Founder = Request.Params["Founder"],
            //    CreationTime = DateTime.Now,
            //    UserId = Convert.ToInt32(Request.Params["UserId"])
            //};
            objDemand.Founder      = Convert.ToInt32(Session["UserId"]);
            objDemand.CreationTime = DateTime.Now;

            ViewBag.SubmissionDepartment   = objDemand.SubmissionDepartment;
            ViewBag.RequirementDescription = objDemand.RequirementDescription;

            if (string.IsNullOrEmpty(objDemand.SubmissionDepartment))
            {
                ViewBag.Mess = "请填写提交部门";
            }
            else if (string.IsNullOrEmpty(objDemand.RequirementDescription))
            {
                ViewBag.Mess = "请填写需求描述";
            }
            else
            {
                //调用业务逻辑
                int result = new BLL.DemandManager().PublishDemandInfo(objDemand);
                //保存数据
                if (result > 0)
                {
                    return(Content("<script>alert('发布成功!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
                }
                else
                {
                    return(Content("<script>alert('发布失败!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
                }
            }
            return(View("AddDemandInfo"));
        }
Exemplo n.º 12
0
 protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     if (msgType == "button_clicked")
     {
         if (panelName == "btnFinishRequest")
         {
             this._app.GameDatabase.SpendDiplomacyPoints(this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID), this._app.GameDatabase.GetPlayerFactionID(this._otherPlayer), this._app.AssetDatabase.GetDiplomaticDemandPointCost(this._type));
             this._app.GameDatabase.InsertDemand(this._demand);
             this._app.UI.CloseDialog((Dialog)this, true);
         }
         else
         {
             if (!(panelName == "btnCancel"))
             {
                 return;
             }
             this._demand = (DemandInfo)null;
             this._app.UI.CloseDialog((Dialog)this, true);
         }
     }
     else if (msgType == "slider_value")
     {
         if (!(panelName == "sldValue"))
         {
             return;
         }
         this._demand.DemandValue = float.Parse(msgParams[0]);
         this._app.UI.SetText("txtValue", msgParams[0]);
     }
     else
     {
         int result;
         if (!(msgType == "text_changed") || !int.TryParse(msgParams[0], out result))
         {
             return;
         }
         this._demand.DemandValue = (float)result;
         this._app.UI.SetSliderValue("sldValue", result);
     }
 }
Exemplo n.º 13
0
 protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     if (msgType == "button_clicked")
     {
         if (panelName == "btnFinishRequest")
         {
             this._app.GameDatabase.SpendDiplomacyPoints(this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID), this._app.GameDatabase.GetPlayerFactionID(this._otherPlayer), this._app.AssetDatabase.GetDiplomaticDemandPointCost(this._type));
             this._app.GameDatabase.InsertDemand(this._demand);
             this._app.UI.CloseDialog((Dialog)this, true);
         }
         else
         {
             if (!(panelName == "btnCancel"))
             {
                 return;
             }
             this._demand = (DemandInfo)null;
             this._app.UI.CloseDialog((Dialog)this, true);
         }
     }
     else
     {
         if (!(msgType == "list_sel_changed") || !(panelName == "lstItems"))
         {
             return;
         }
         if (this._starmap.Systems.Reverse.ContainsKey((int)this._demand.DemandValue))
         {
             this._starmap.PostSetProp("ProvinceSystemSelectEffect", (object)false, (object)this._starmap.Systems.Reverse[(int)this._demand.DemandValue]);
         }
         this._demand.DemandValue = float.Parse(msgParams[0]);
         if (!this._starmap.Systems.Reverse.ContainsKey((int)this._demand.DemandValue))
         {
             return;
         }
         this._starmap.SetFocus((IGameObject)this._starmap.Systems.Reverse[(int)this._demand.DemandValue]);
         this._starmap.PostSetProp("ProvinceSystemSelectEffect", (object)true, (object)this._starmap.Systems.Reverse[(int)this._demand.DemandValue]);
         this._app.Game.StarMapSelectedObject = (object)this._starmap.Systems.Reverse[(int)this._demand.DemandValue];
     }
 }
Exemplo n.º 14
0
        public ActionResult ConfirmDemandInfo(DemandInfo objDemand)
        {
            //根据需求编号获取需求数据
            var old = objDemand;

            objDemand             = new BLL.DemandManager().GetDemandDetailByDemandId(objDemand.DemandId);
            objDemand.PlanContent = old.PlanContent;

            objDemand.ExpectedOnlineTime = old.ExpectedOnlineTime;
            //保存数据
            //ViewBag.PlanContent = objDemand.PlanContent;
            //ViewBag.ExpectedOnlineTime = objDemand.ExpectedOnlineTime;

            if (string.IsNullOrEmpty(objDemand.PlanContent))
            {
                ViewBag.M = "上线计划内容不能为空";
            }
            else if (objDemand.ExpectedOnlineTime == null)
            {
                ViewBag.M = "请选择预计上线时间";
            }
            else
            {
                objDemand.ConfirmationPerson = Convert.ToInt32(Session["UserId"]);
                objDemand.ConfirmTime        = DateTime.Now;
                //调用业务逻辑
                int result = new BLL.DemandManager().ConfirmDemand(objDemand);
                if (result > 0)
                {
                    return(Content("<script>alert('认领成功!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
                }
                else
                {
                    return(Content("<script>alert('认领失败!');document.location='" + Url.Action("Index", "Demand") + "';</script>"));
                }
            }
            return(View("ConfrimDemand", objDemand));
        }
Exemplo n.º 15
0
 public DemandRequestedDialog(App game, DemandInfo di, string template = "dialogRequested")
     : base(game, template)
 {
     this._demand = di;
 }
Exemplo n.º 16
0
 /// <summary>
 /// 根据需求详情ID编号修改需求
 /// </summary>
 /// <param name="objDemand"></param>
 /// <returns></returns>
 public int ModifyDemandInfoByDemandId(DemandInfo objDemand)
 {
     return(new DAL.DemandService().ModifyDemandInfoByDemandId(objDemand));
 }
Exemplo n.º 17
0
 /// <summary>
 /// 认领需求
 /// </summary>
 /// <param name="objDemand"></param>
 /// <returns></returns>
 public int ConfirmDemand(DemandInfo objDemand)
 {
     return(new DAL.DemandService().ConfirmDemand(objDemand));
 }
Exemplo n.º 18
0
 /// <summary>
 /// 发布需求
 /// </summary>
 /// <param name="objDemand"></param>
 /// <returns></returns>
 public int PublishDemandInfo(DemandInfo objDemand)
 {
     return(new DAL.DemandService().AddDemandInfo(objDemand));
 }
Exemplo n.º 19
0
        /// <summary>
        /// 根据需求编号查询需求详情
        /// </summary>
        /// <param name="DemandId">需求编号</param>
        /// <returns></returns>
        public DemandInfo GetDemandDetailByConfirmationPerson(int DemandInfoId)
        {
            string sql = @"select d.[DemandId],d.ProductId,p.ProductName,d.[SubmissionDepartment],d.[RequirementDescription],
d.EmergencyId, e.EmergencyName, d.Founder,u.UserName, d.[CreationTime], 
d.Modifier,ModifierName=(SELECT ur.UserName FROM Users AS ur WHERE ur.UserId=d.Modifier), d.ModificationTime, 
d.ConfirmationPerson, ConfirmationName=(SELECT ur.UserName FROM Users AS ur WHERE ur.UserId=d.ConfirmationPerson),
d.ConfirmTime, d.ExpectedOnlineTime, d.PlanContent,
d.Publisher,Upline=(SELECT ur.UserName FROM Users AS ur WHERE ur.UserId=d.Publisher),
d.ScheduleTime, d.UpTime from DemandInfo AS d
left join EmergencyDegree AS e on d.EmergencyId = e.EmergencyId
left join Products AS p on d.ProductId = p.ProductId
left join Users AS u on d.Founder = u.UserId 
 where [ConfirmationPerson]=@DemandInfoId";

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@DemandInfoId", DemandInfoId)
            };
            SqlDataReader objReader = SQLHelper.GetReader(sql, paras);
            DemandInfo    demand    = null;

            if (objReader.Read())
            {
                //DemandInfo entity = new DemandInfo();
                //demand = entity;
                //entity.DemandId = Convert.ToInt32(objReader["DemandId"]);
                //entity.ProductId = Convert.ToInt32(objReader["ProductId"]);
                //if (objReader["DemandId"] is DBNull){
                //    entity.ModificationTime = null;
                //}
                //else
                //{
                //    entity.ModificationTime = Convert.ToDateTime(objReader["DemandId"]);
                //}
                //if (objReader["ProductId"] is DBNull)
                //{
                //    entity.ModificationTime = null;
                //}
                //else
                //{
                //    entity.ModificationTime = Convert.ToDateTime(objReader["ProductId"]);
                //}


                demand = new DemandInfo()
                {
                    DemandId               = ConvertInt(objReader["DemandId"].ToString()),                      //需求详情编号
                    ProductId              = ConvertInt(objReader["ProductId"].ToString()),                     //产品编号
                    ProductName            = objReader["ProductName"]?.ToString(),                              //产品名称
                    SubmissionDepartment   = objReader["SubmissionDepartment"]?.ToString(),                     //提交部门
                    RequirementDescription = objReader["RequirementDescription"]?.ToString(),                   //需求描述
                    EmergencyId            = ConvertInt(objReader["EmergencyId"].ToString()),                   //紧急程度编号
                    EmergencyName          = objReader["EmergencyName"]?.ToString(),                            //紧急程度名称
                    Founder            = ConvertInt(objReader["Founder"].ToString()),                           //创建人编号
                    UserName           = objReader["UserName"]?.ToString(),                                     //创建人
                    CreationTime       = (objReader["CreationTime"]?.ToString()).ConvertReaderDateTime(),       //创建时间
                    Modifier           = ConvertInt(objReader["Modifier"].ToString()),                          //修改人编号
                    ModifierName       = objReader["ModifierName"]?.ToString(),                                 //修改人
                    ModificationTime   = (objReader["ModificationTime"]?.ToString()).ConvertReaderDateTime(),   //修改时间
                    ConfirmationPerson = ConvertInt(objReader["ConfirmationPerson"].ToString()),                //确认人编号
                    ConfirmationName   = objReader["ConfirmationName"]?.ToString(),                             //确认人
                    ConfirmTime        = (objReader["ConfirmTime"]?.ToString()).ConvertReaderDateTime(),        //确认时间
                    ExpectedOnlineTime = (objReader["ExpectedOnlineTime"]?.ToString()).ConvertReaderDateTime(), //预计上线时间
                    PlanContent        = objReader["PlanContent"]?.ToString(),                                  //上线计划内容
                    Publisher          = ConvertInt(objReader["Publisher"].ToString()),                         //发布人编号
                    Upline             = objReader["Upline"]?.ToString(),                                       //发布人
                    ScheduleTime       = (objReader["ScheduleTime"]?.ToString()).ConvertReaderDateTime(),       //发布时间
                    UpTime             = (objReader["UpTime"]?.ToString()).ConvertReaderDateTime(),             //上线时间
                };
            }
            objReader.Close();
            return(demand);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 组装客户信息
        /// </summary>
        /// <param name="Mobile">手机号</param>
        /// <param name="IDNumber">身份证号</param>
        /// <param name="Tag">输出的客户信息</param>
        /// <returns>组装结果</returns>
        private int AssembleCustomerInfo(String Mobile, String IDNumber, out PersonTag Tag)
        {
            Tag             = new PersonTag();
            Tag.TradeInfos  = new List <TradeInfo>();
            Tag.DemandInfos = new List <DemandInfo>();

            DataSet ResultSet = new DataSet();

            //按给定的Mobile和IDNumber查询客户信息
            try
            {
                ResultSet = new DbHelperSQLP(ConnStringCustomerInfo).RunProcedure("P_QueryCustomerInfo",
                                                                                  new IDataParameter[] { new SqlParameter("@Mobile", Mobile), new SqlParameter("@IDNumber", IDNumber) }
                                                                                  , "noname");
            }
            catch (Exception)
            {
                Tag = null;
                return(-1);
            }

            //没有查到
            if (ResultSet.Tables[0].Rows.Count == 0 &&
                ResultSet.Tables[1].Rows.Count == 0 &&
                ResultSet.Tables[2].Rows.Count == 0 &&
                ResultSet.Tables[3].Rows.Count == 0)
            {
                Tag = null;
                return(-3);
            }

            Tag.Mobile   = Mobile;
            Tag.IDNumber = IDNumber;


            //同时提供手机号和身份证号时
            if (!String.IsNullOrEmpty(IDNumber) && !String.IsNullOrEmpty(Mobile))
            {
                //检查同时提供手机号和身份证号时,是否与库中数据匹配
                bool MobileMatchesIDNumber = false;
                for (int i = 0; i < ResultSet.Tables[1].Rows.Count; i++)
                {
                    String CheckStringMobile   = ResultSet.Tables[1].Rows[i]["mobile"].ToString();
                    String CheckStringIDNumber = ResultSet.Tables[1].Rows[i]["id_number"].ToString();

                    if (CheckStringMobile.Length == 11 && CheckStringIDNumber.Length >= 15 &&
                        CheckStringMobile == Mobile && CheckStringIDNumber == IDNumber)
                    {
                        MobileMatchesIDNumber = true;
                        break;
                    }
                }
                if (MobileMatchesIDNumber == false)
                {
                    return(-2);
                }
            }

            if (String.IsNullOrWhiteSpace(Mobile))
            {
                Tag.Mobile = GetSpecificInfoFromDataset(ResultSet,
                                                        1, "mobile", DataSetResultQueryType.MostOccuredValue);
            }

            if (String.IsNullOrWhiteSpace(IDNumber))
            {
                Tag.IDNumber = GetSpecificInfoFromDataset(ResultSet,
                                                          1, "id_number", DataSetResultQueryType.MostOccuredValue);
            }

            Tag.Name = GetSpecificInfoFromDataset(ResultSet,
                                                  1, "customer_name", DataSetResultQueryType.MostOccuredValue);

            Tag.Sex = GetSpecificInfoFromDataset(ResultSet,
                                                 1, "sex", DataSetResultQueryType.MostOccuredValue);
            if (String.IsNullOrWhiteSpace(Tag.Sex) && !String.IsNullOrWhiteSpace(Tag.IDNumber))
            {
                Tag.Sex = GetSexFromIDNumber(Tag.IDNumber);
            }

            Tag.Age = "";
            if (!String.IsNullOrWhiteSpace(Tag.IDNumber))
            {
                int IDNumberAge = GetAgeFromIDNumber(Tag.IDNumber);
                if (IDNumberAge >= 0)
                {
                    Tag.Age = IDNumberAge.ToString();
                }
            }

            Tag.RegisterCity = GetSpecificInfoFromDataset(ResultSet,
                                                          1, "census_register", DataSetResultQueryType.MostOccuredValue);

            Tag.Profession = GetSpecificInfoFromDataset(ResultSet,
                                                        3, "industry", DataSetResultQueryType.CommaSeparatedValues, 2);

            Tag.Interests = GetSpecificInfoFromDataset(ResultSet,
                                                       3, "tags", DataSetResultQueryType.CommaSeparatedValues, 3);

            Tag.FamilyIncome = GetSpecificInfoFromDataset(ResultSet,
                                                          3, "family_income", DataSetResultQueryType.MostOccuredValue);

            Tag.Marriage = GetSpecificInfoFromDataset(ResultSet,
                                                      3, "marry", DataSetResultQueryType.MostOccuredValue);

            Tag.FamilyStatus = GetSpecificInfoFromDataset(ResultSet,
                                                          3, "family_structure", DataSetResultQueryType.MostOccuredValue);

            Tag.ChildrenStatus = GetSpecificInfoFromDataset(ResultSet,
                                                            3, "children_info", DataSetResultQueryType.MostOccuredValue);

            //解析家庭
            if (ResultSet.Tables[2].Rows.Count > 1)
            {
                //载入性别年龄
                List <int>    Ages  = new List <int>();
                List <String> Sexes = new List <string>();
                for (int i = 0; i < ResultSet.Tables[2].Rows.Count; i++)
                {
                    int    Age = GetAgeFromIDNumber(ResultSet.Tables[2].Rows[i]["id_number"].ToString());
                    String Sex = GetSexFromIDNumber(ResultSet.Tables[2].Rows[i]["id_number"].ToString());

                    if (Age >= 0 && (Sex == "男" || Sex == "女"))
                    {
                        Ages.Add(Age);
                        Sexes.Add(Sex);
                    }
                }

                ////2异性一代人 异性且年龄差<18
                ////2同性一代人 同性且年龄差<18
                ////2两代人 年龄差≥18
                ////3一代人 年龄极差<18
                ////3两代人 年龄极差≥18且存在两个年龄相差<18
                ////3三代人 任意两年龄极差≥18
                ////4一代人 年龄极差<18
                ////4两代人 年龄极差≥18且任意年龄值的min{ 该年龄值与两个极值的差值的绝对值}<18
                ////4三代人 年龄极差≥18且存在一个年龄值min{ 该年龄值与两个极值的差值的绝对值}≥18
                ////    且存在一个年龄值min{ 该年龄值与其他三个的差值的绝对值}<18
                ////4四代人 任意两年龄极差≥18  任意两年龄极差≥18
                ////≥5                      署名人数≥5

                //2人情况
                if (Ages.Count == 2)
                {
                    if (Math.Abs(Ages[0] - Ages[1]) < 18)
                    {
                        if (Sexes[0] != Sexes[1])
                        {
                            Tag.FamilyStatus = "2人,异性,一代人";
                            if (Math.Abs(Ages[0] - Ages[1]) <= 5)
                            {
                                Tag.Marriage = "已婚";
                            }
                        }
                        else
                        {
                            Tag.FamilyStatus = "2人,同性,一代人";
                        }
                    }
                    else
                    {
                        Tag.FamilyStatus = "2人,两代人";
                        if (Ages[0] < 18 || Ages[1] < 18)
                        {
                            Tag.FamilyStatus += ",有未成年子女";
                        }
                    }
                }

                int MaxAge = Ages.Max();
                int MinAge = Ages.Min();

                //3人情况
                if (Ages.Count == 3)
                {
                    if (MaxAge - MinAge < 18)
                    {
                        Tag.FamilyStatus = "3人,一代人";
                    }

                    if (MaxAge - MinAge >= 18)
                    {
                        for (int i = 0; i < Ages.Count; i++)
                        {
                            if (Math.Abs(Ages[0] - Ages[1]) < 18 ||
                                Math.Abs(Ages[1] - Ages[2]) < 18 ||
                                Math.Abs(Ages[0] - Ages[2]) < 18)
                            {
                                Tag.FamilyStatus = "3人,两代人";
                                if (MinAge < 18)
                                {
                                    Tag.FamilyStatus += ",有未成年子女";
                                }
                            }
                        }
                    }

                    if (Math.Abs(Ages[0] - Ages[1]) >= 18 &&
                        Math.Abs(Ages[2] - Ages[1]) >= 18 &&
                        Math.Abs(Ages[0] - Ages[2]) >= 18)
                    {
                        Tag.FamilyStatus = "3人,三代人";
                        if (MinAge < 18)
                        {
                            Tag.FamilyStatus += ",有未成年子女";
                        }
                    }
                }

                //4人情况
                if (Ages.Count == 4)
                {
                    if (MaxAge - MinAge < 18)
                    {
                        Tag.FamilyStatus = "4人,一代人";
                    }

                    //排序,从小到大
                    List <int> SortedAges = Ages.ToList <int>();
                    SortedAges.Sort();

                    if (SortedAges[3] - SortedAges[0] >= 18 &&
                        SortedAges[3] - SortedAges[2] < 18 &&
                        SortedAges[1] - SortedAges[0] < 18)
                    {
                        Tag.FamilyStatus = "4人,两代人";
                    }

                    if (SortedAges[3] - SortedAges[0] >= 18 && (
                            (SortedAges[3] - SortedAges[2] < 18 && SortedAges[2] - SortedAges[1] >= 18 &&
                             SortedAges[1] - SortedAges[0] >= 18) ||
                            (SortedAges[3] - SortedAges[2] >= 18 && SortedAges[2] - SortedAges[1] >= 18 &&
                             SortedAges[1] - SortedAges[0] < 18)))
                    {
                        Tag.FamilyStatus = "4人,三代人";
                    }

                    if (SortedAges[3] - SortedAges[2] >= 18 && SortedAges[2] - SortedAges[1] >= 18 &&
                        SortedAges[1] - SortedAges[0] >= 18)
                    {
                        Tag.FamilyStatus = "4人,四代人";
                    }
                }

                if (Ages.Count > 5)
                {
                    Tag.FamilyStatus = "多人共同居住";
                }
            }

            //需求和成交记录
            for (int i = 0; i < ResultSet.Tables[0].Rows.Count; i++)
            {
                DemandInfo DI = new DemandInfo();

                DateTime DemandTime;
                if (DateTime.TryParse(ResultSet.Tables[0].Rows[i]["demand_time"].ToString(), out DemandTime) == false)
                {
                    continue;
                }

                //保护最近180天需求数据
                //if ((DateTime.Now - DemandTime).TotalDays <= 180)
                //{
                //    continue;
                //}

                DI.DemandDate    = DemandTime.ToString("yyyy-MM-dd");
                DI.DemandCity    = ResultSet.Tables[0].Rows[i]["city"].ToString();
                DI.DemandGrade   = ResultSet.Tables[0].Rows[i]["buy_grade"].ToString();
                DI.DemandProject = ResultSet.Tables[0].Rows[i]["project_name"].ToString();
                DI.DemandPurpose = ResultSet.Tables[0].Rows[i]["buy_purpose"].ToString();

                //查重
                bool IsExisted = false;
                for (int j = 0; j < Tag.DemandInfos.Count; j++)
                {
                    if (Tag.DemandInfos[j].DemandCity == DI.DemandCity &&
                        Tag.DemandInfos[j].DemandDate == DI.DemandDate &&
                        Tag.DemandInfos[j].DemandGrade == DI.DemandGrade &&
                        Tag.DemandInfos[j].DemandProject == DI.DemandProject &&
                        Tag.DemandInfos[j].DemandPurpose == DI.DemandPurpose)
                    {
                        IsExisted = true;
                        break;
                    }
                }

                if (!IsExisted)
                {
                    Tag.DemandInfos.Add(DI);
                }
            }

            for (int i = 0; i < ResultSet.Tables[1].Rows.Count; i++)
            {
                TradeInfo TI = new TradeInfo();

                DateTime TradeTime;
                if (DateTime.TryParse(ResultSet.Tables[1].Rows[i]["trade_date"].ToString(), out TradeTime) == false)
                {
                    continue;
                }

                //保护最近720天成交数据
                //if ((DateTime.Now - TradeTime).TotalDays <= 720)
                //{
                //    continue;
                //}

                TI.TradeDate    = TradeTime.ToString("yyyy-MM-dd");
                TI.TradeCity    = ResultSet.Tables[1].Rows[i]["trade_city"].ToString();
                TI.TradeGrade   = ResultSet.Tables[1].Rows[i]["trade_project_grade"].ToString();
                TI.TradeProject = ResultSet.Tables[1].Rows[i]["trade_project_name"].ToString();
                TI.TradePurpose = ResultSet.Tables[1].Rows[i]["trade_project_purpose"].ToString();

                bool IsExisted = false;
                for (int j = 0; j < Tag.TradeInfos.Count; j++)
                {
                    if (Tag.TradeInfos[j].TradeCity == TI.TradeCity &&
                        Tag.TradeInfos[j].TradeDate == TI.TradeDate &&
                        Tag.TradeInfos[j].TradeGrade == TI.TradeGrade &&
                        Tag.TradeInfos[j].TradeProject == TI.TradeProject &&
                        Tag.TradeInfos[j].TradePurpose == TI.TradePurpose)
                    {
                        IsExisted = true;
                        break;
                    }
                }

                if (!IsExisted)
                {
                    Tag.TradeInfos.Add(TI);
                }
            }

            return(0);
        }
Exemplo n.º 21
0
 /// <summary>
 /// 确认上线
 /// </summary>
 /// <param name="objDemand"></param>
 /// <returns></returns>
 public int UpLineDemand(DemandInfo objDemand)
 {
     return(new DAL.DemandService().UpLineDemand(objDemand));
 }