Exemple #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);
        }
Exemple #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Model.member bllmem = new Model.member();
            bllmem.Mid      = MemberCardNo.Value;
            bllmem.Name     = Name.Value;
            bllmem.Mtype    = Convert.ToInt32(CategoryId.SelectedValue);
            bllmem.Sex      = Convert.ToBoolean(Convert.ToInt32(Sex.SelectedValue));
            bllmem.Zjtype   = Convert.ToInt32(CardType.SelectedValue);
            bllmem.ZjNumber = CardNo.Value;
            bllmem.sales    = 0;
            bllmem.Phone    = Phone.Value;
            if (BirthDay.Value == "")
            {
                bllmem.Baithday = null;
            }
            else
            {
                bllmem.Baithday = Convert.ToDateTime(BirthDay.Value);
            }
            bllmem.Pwd     = Password.Text;
            bllmem.Likes   = Love.Value;
            bllmem.Address = Address.Value;
            bllmem.Ramrek  = Remark.Value;
            bllmem.AddUser = UserNow.UserID;
            if (Request.Form["GiveScore"] == "")
            {
                bllmem.Integration = 0;
            }
            else
            {
                bllmem.Integration = Convert.ToInt32(Request.Form["GiveScore"]);
            }
            bllmem.Statid = 0;

            if (Request.QueryString["type"] == "edit")
            {
                bllmem.Mid     = Request.QueryString["id"];
                bllmem.AddDate = bll.GetModel(bllmem.Mid).AddDate;
                bllmem.XqTime  = bll.GetModel(bllmem.Mid).XqTime;
                if (bll.Update(bllmem))
                {
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('更新成功');parent.window.location.reload();</script>");
                }
            }
            else
            {
                bllmem.IntegraDj = Convert.ToInt32(NoCardFee.Checked);
                bllmem.AddDate   = DateTime.Now;
                if (bll.Add(bllmem))
                {
                    Model.memberType modelmt = bllmt.GetModel(Convert.ToInt32(bllmem.Mtype));
                    bllmem.XqTime = modelmt.XqTime;
                    bll.Update(bllmem);
                    Model.mRecords modemr = new Model.mRecords();
                    modemr.mmid   = bllmem.Mid;
                    modemr.Price  = Convert.ToInt32(Request.Form["TopAmount"].ToString());
                    modemr.Type   = 1;
                    modemr.Remark = "";
                    bllmr.Add(modemr);
                    Model.mRecords modemrjf = new Model.mRecords();
                    modemrjf.mmid = bllmem.Mid;
                    if (Request.Form["GiveScore"] == "")
                    {
                        modemrjf.Price = 0;
                    }
                    else
                    {
                        modemrjf.Price = Convert.ToInt32(Request.Form["GiveScore"]);
                    }
                    modemrjf.Type   = 3;
                    modemrjf.Remark = "";
                    bllmr.Add(modemrjf);
                    int Amount = Convert.ToInt32(Request.Form["Amount"]);
                    BC(Amount);
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('保存成功');parent.window.location.reload();</script>");
                }
            }
        }
        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);
        }