Ejemplo n.º 1
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.member   bll   = new BLL.member();
            Model.member model = bll.GetModel(_id);
            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.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改协会会员:" + model.no); //记录日志
                result = true;
            }

            return(result);
        }
Ejemplo n.º 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>");
                }
            }
        }
Ejemplo n.º 3
0
        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);
        }