private bool DoAdd()
        {
            Model.member model = new Model.member();
            BLL.member   bll   = new BLL.member();
            //检测会员证号码是否重复
            if (bll.Exists(txtNo.Text.Trim()))
            {
                return(false);
            }
            model.no         = txtNo.Text.Trim();
            model.name       = txtName.Text.Trim();
            model.type       = rblType.SelectedValue.ToString();
            model.level      = ddlMemberLevel.SelectedValue.ToString();
            model.gender     = rblGender.SelectedValue.ToString();
            model.id_card    = txtIdCard.Text.Trim();
            model.tel        = txtTel.Text.Trim();
            model.town       = ddlTown.SelectedValue.ToString();
            model.village    = ddlVillage.SelectedValue.ToString();
            model.amount     = Utils.StrToDecimal(txtAmount.Text, 0);
            model.can_amount = model.amount * 10;
            model.yh_amount  = Utils.StrToDecimal(txtYh.Text, 0);
            model.peigu      = Utils.StrToDecimal(txtPeigu.Text, 0);
            if (model.peigu >= 3000)
            {
                model.can_amount = model.amount * 10 + model.peigu;
            }
            model.no       = txtNo.Text.Trim();
            model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.date     = Utils.StrToDateTime(txtDate.Text.Trim());
            model.remark   = txtRemark.Text.Trim();
            model.img_url  = txtImgUrl.Text.Trim();
            #region 保存相册====================
            string[] albumArr    = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr   = Request.Form.GetValues("hid_photo_remark");
            string[] link_urlArr = Request.Form.GetValues("hid_photo_link_url");
            if (albumArr != null && albumArr.Length > 0)
            {
                List <Model.member_albums> ls = new List <Model.member_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(link_urlArr[i]))
                        {
                            ls.Add(new Model.member_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2], link_url = link_urlArr[i]
                            });
                        }
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.member_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.member_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }
            #endregion

            #region 保存相册====================
            string[] cw_albumArr    = Request.Form.GetValues("hid_photo_cw_name");
            string[] cw_remarkArr   = Request.Form.GetValues("hid_photo_cw_remark");
            string[] cw_link_urlArr = Request.Form.GetValues("hid_photo_cw_link_url");
            if (cw_albumArr != null && cw_albumArr.Length > 0)
            {
                List <Model.member_cw_albums> ls = new List <Model.member_cw_albums>();
                for (int i = 0; i < cw_albumArr.Length; i++)
                {
                    string[] imgArr = cw_albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(link_urlArr[i]))
                        {
                            ls.Add(new Model.member_cw_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2], link_url = link_urlArr[i]
                            });
                        }
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.member_cw_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.member_cw_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2]
                            });
                        }
                    }
                }
                model.cw_albums = ls;
            }
            #endregion
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加协会会员:" + model.no); //记录日志
                return(true);
            }
            return(false);
        }
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.member   bll   = new BLL.member();
            Model.member model = bll.GetModel(_id);
            model.no         = txtNo.Text.Trim();
            model.name       = txtName.Text.Trim();
            model.type       = rblType.SelectedValue.ToString();
            model.level      = ddlMemberLevel.SelectedValue.ToString();
            model.gender     = rblGender.SelectedValue.ToString();
            model.id_card    = txtIdCard.Text.Trim();
            model.tel        = txtTel.Text.Trim();
            model.town       = ddlTown.SelectedValue.ToString();
            model.village    = ddlVillage.SelectedValue.ToString();
            model.amount     = Utils.StrToDecimal(txtAmount.Text, 0);
            model.yh_amount  = Utils.StrToDecimal(txtYh.Text, 0);
            model.peigu      = Utils.StrToDecimal(txtPeigu.Text, 0);
            model.can_amount = model.amount * 10;
            model.no         = txtNo.Text.Trim();
            model.add_time   = Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.date       = Utils.StrToDateTime(txtDate.Text.Trim());
            model.remark     = txtRemark.Text.Trim();
            model.img_url    = txtImgUrl.Text.Trim();
            if (model.peigu >= 3000)
            {
                model.can_amount = model.amount * 10 + model.peigu;
            }
            #region 保存相册====================
            //检查是否有自定义图片
            if (model.albums != null)
            {
                model.albums.Clear();
            }
            string[] albumArr   = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr  = Request.Form.GetValues("hid_photo_remark");
            string[] linkUrlArr = Request.Form.GetValues("hid_photo_link_url");
            if (albumArr != null)
            {
                List <Model.member_albums> ls = new List <Model.member_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = Utils.StrToInt(imgArr[0], 0);
                    if (imgArr.Length == 3)
                    {
                        if (linkUrlArr != null && !string.IsNullOrEmpty(linkUrlArr[i]) && !string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.member_albums {
                                id = img_id, member_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i], link_url = linkUrlArr[i]
                            });
                        }
                        else if (linkUrlArr != null && !string.IsNullOrEmpty(remarkArr[i]) && string.IsNullOrEmpty(linkUrlArr[i]))
                        {
                            ls.Add(new Model.member_albums {
                                id = img_id, member_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else if (linkUrlArr != null && !string.IsNullOrEmpty(linkUrlArr[i]) && string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.member_albums {
                                id = img_id, member_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], link_url = linkUrlArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.member_albums {
                                id = img_id, member_id = _id, original_path = imgArr[1], thumb_path = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }
            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改协会会员:" + model.no); //记录日志
                result = true;
            }

            return(result);
        }
Beispiel #3
0
        public void MemberCount()
        {
            List <string> xData = new List <string>();
            List <int>    yData = new List <int>();
            var           bll   = new BLL.member();
            var           ds    = bll.GetListByType().Tables[0];

            foreach (DataRow dr in ds.Rows)
            {
                if (dr["type"].ToString() == "0")
                {
                    xData.Add("常规会员");
                }
                else
                {
                    xData.Add("贫困户会员");
                }
                yData.Add(Utils.StrToInt(dr["count"].ToString(), 0));
            }
            Chart1.Series[0]["PieLabelStyle"] = "Outside"; //将文字移到外侧
            Chart1.Series[0]["PieLineColor"]  = "Black";   //绘制黑色的连线。
            Chart1.Series[0].Points.DataBindXY(xData, yData);


            List <string> xLevelData = new List <string>();
            List <int>    yLevelData = new List <int>();
            var           dsLevel    = bll.GetListByLevel().Tables[0];
            var           bllLevel   = new BLL.member_level();

            foreach (DataRow dr in dsLevel.Rows)
            {
                var level = bllLevel.GetName(Utils.StrToInt(dr["level"].ToString(), 0));
                xLevelData.Add(level);
                yLevelData.Add(Utils.StrToInt(dr["count"].ToString(), 0));
            }
            Chart2.Series[0]["PieLabelStyle"] = "Outside"; //将文字移到外侧
            Chart2.Series[0]["PieLineColor"]  = "Black";   //绘制黑色的连线。
            Chart2.Series[0].Points.DataBindXY(xLevelData, yLevelData);

            List <string> xTownData = new List <string>();
            List <int>    yTownData = new List <int>();
            var           dsTown    = bll.GetListByTown().Tables[0];

            foreach (DataRow dr in dsTown.Rows)
            {
                var villageBll = new BLL.village();
                var town       = villageBll.GetName(Utils.StrToInt(dr["town"].ToString(), 0));
                xTownData.Add(town);
                yTownData.Add(Utils.StrToInt(dr["count"].ToString(), 0));
            }
            Chart3.Series[0]["PieLabelStyle"] = "Outside"; //将文字移到外侧
            Chart3.Series[0]["PieLineColor"]  = "Black";   //绘制黑色的连线。
            Chart3.Series[0].Points.DataBindXY(xTownData, yTownData);

            //List<string> xTData = new List<string>() { "A", "B", "C", "D" };
            //List<int> yTData = new List<int>() { 10, 10, 30, 40 };
            ////线条颜色
            //Chart4.Series[0].Color = Color.Green;
            ////线条粗细
            //Chart4.Series[0].BorderWidth = 3;
            ////标记点边框颜色
            //Chart4.Series[0].MarkerBorderColor = Color.Black;
            ////标记点边框大小
            //Chart4.Series[0].MarkerBorderWidth = 3;
            ////标记点中心颜色
            //Chart4.Series[0].MarkerColor = Color.Red;
            ////标记点大小
            //Chart4.Series[0].MarkerSize = 8;
            ////标记点类型
            //Chart4.Series[0].MarkerStyle = MarkerStyle.Circle;
            ////将文字移到外侧
            //Chart4.Series[0]["PieLabelStyle"] = "Outside";
            ////绘制黑色的连线
            //Chart4.Series[0]["PieLineColor"] = "Black";
            //Chart4.Series[0].Points.DataBindXY(xTData, yTData);
        }