Ejemplo n.º 1
0
        private bool DoAdd()
        {
            Model.member model = new Model.member();
            BLL.member   bll   = new BLL.member();
            //检测会员证号码是否重复
            if (bll.Exists(txtNo.Text.Trim()))
            {
                JscriptMsg("会员证号码重复!", "");
                return(false);
            }
            model.town      = ddlTown.SelectedValue.ToString();
            model.village   = ddlVillage.SelectedValue.ToString();
            model.address   = txtAddress.Text.Trim();
            model.no        = txtNo.Text.Trim();
            model.name      = txtName.Text.Trim();
            model.gender    = rblGender.SelectedValue.ToString();
            model.birthday  = txtBirthday.Text.Trim();
            model.education = ddlEducation.SelectedValue.ToString();
            model.id_card   = txtIdCard.Text.Trim();
            model.amount    = Utils.StrToDecimal(txtAmount.Text, 0);
            model.add_time  = Utils.StrToDateTime(txtAddTime.Text.Trim());
            if (model.town == "0")
            {
                JscriptMsg("请填写所属乡镇!", "");
                return(false);
            }
            if (model.village == "0")
            {
                JscriptMsg("请填写所属村庄!", "");
                return(false);
            }
            if (string.IsNullOrEmpty(model.no))
            {
                JscriptMsg("请填写会员编号!", "");
                return(false);
            }
            if (string.IsNullOrEmpty(model.name))
            {
                JscriptMsg("请填写姓名!", "");
                return(false);
            }
            List <Model.member_family> ls = new List <Model.member_family>();
            var familyModel = new Model.member_family();

            if (!string.IsNullOrEmpty(txtFamilyName1.Text.Trim()))
            {
                familyModel.name         = txtFamilyName1.Text.Trim();
                familyModel.gender       = ddlFamilyGender1.SelectedValue.ToString();
                familyModel.relationship = txtFamilyRel1.Text.Trim();
                familyModel.birthday     = txtFamilyBir1.Text.Trim();
                familyModel.education    = ddlFamilyEdu1.SelectedValue.ToString();
                ls.Add(familyModel);
            }
            if (!string.IsNullOrEmpty(txtFamilyName2.Text.Trim()))
            {
                familyModel.name         = txtFamilyName2.Text.Trim();
                familyModel.gender       = ddlFamilyGender2.SelectedValue.ToString();
                familyModel.relationship = txtFamilyRel2.Text.Trim();
                familyModel.birthday     = txtFamilyBir2.Text.Trim();
                familyModel.education    = ddlFamilyEdu2.SelectedValue.ToString();
                ls.Add(familyModel);
            }
            if (!string.IsNullOrEmpty(txtFamilyName3.Text.Trim()))
            {
                familyModel.name         = txtFamilyName3.Text.Trim();
                familyModel.gender       = ddlFamilyGender3.SelectedValue.ToString();
                familyModel.relationship = txtFamilyRel3.Text.Trim();
                familyModel.birthday     = txtFamilyBir3.Text.Trim();
                familyModel.education    = ddlFamilyEdu3.SelectedValue.ToString();
                ls.Add(familyModel);
            }
            model.family = ls;
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加协会会员:" + model.no); //记录日志
                JscriptMsg("添加协会会员信息成功!", "member_list.aspx");
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        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);
        }