예제 #1
0
        private int add_account()
        {
            Maticsoft.BLL.account   acc_bll = new BLL.account();
            Maticsoft.Model.account acc_mod = new Model.account();
            acc_mod.leibei = leibie.SelectedValue;
            if (leibie.SelectedValue == "培训班费用")
            {
                acc_mod.peixunban_id = Convert.ToInt16(qishu.SelectedValue);
            }
            else
            {
                acc_mod.peixunban_id = 0;
            }
            acc_mod.name   = name.Text.Trim();
            acc_mod.time   = Convert.ToDateTime(luru_time.Text.Trim());
            acc_mod.beizhu = beizhu.Text.Trim();

            acc_mod.lururen = jingshouren.SelectedValue;

            int i = acc_bll.Add(acc_mod);

            return(i);
        }
예제 #2
0
        private int DoAdd()
        {
            var successCount = 0;

            for (int i = 0; i < 10; i++)
            {
                DropDownList ddlXiehui   = FindControl("ddlXiehui" + i) as DropDownList;
                DropDownList ddlBSubject = FindControl("ddlBSubject" + i) as DropDownList;
                DropDownList ddlSSubject = FindControl("ddlSSubject" + i) as DropDownList;
                TextBox      txtAddTime  = FindControl("txtAddTime" + i) as TextBox;
                TextBox      txtJie      = FindControl("txtJie" + i) as TextBox;
                TextBox      txtDai      = FindControl("txtDai" + i) as TextBox;
                TextBox      txtZhaiyao  = FindControl("txtZhaiyao" + i) as TextBox;

                if (ddlXiehui.SelectedValue.ToString() != "0")
                {
                    if (ddlBSubject.SelectedValue.ToString() == "0")
                    {
                        JscriptMsg("请选择大类!", "");
                        return(0);
                    }
                    if (ddlSSubject.SelectedValue.ToString() == "0")
                    {
                        JscriptMsg("请选择小类!", "");
                        return(0);
                    }

                    Model.account model = new Model.account();
                    BLL.account   bll   = new BLL.account();
                    model.xiehui_id = Utils.StrToInt(ddlXiehui.SelectedValue, 0);
                    model.b_subject = Utils.StrToInt(ddlBSubject.SelectedValue, 0);
                    model.s_subject = Utils.StrToInt(ddlSSubject.SelectedValue, 0);
                    model.date      = Utils.StrToDateTime(txtAddTime.Text.Trim()).Date;
                    model.jie       = Utils.StrToDecimal(Utils.ObjectToStr(txtJie.Text.Trim()), 0);
                    model.dai       = Utils.StrToDecimal(Utils.ObjectToStr(txtDai.Text.Trim()), 0);
                    model.zhaiyao   = txtZhaiyao.Text.Trim();
                    #region 保存相册====================
                    string[] albumArr    = Request.Form.GetValues("hid_photo_name" + i);
                    string[] remarkArr   = Request.Form.GetValues("hid_photo_remark" + i);
                    string[] link_urlArr = Request.Form.GetValues("hid_photo_link_url" + i);
                    if (albumArr != null && albumArr.Length > 0)
                    {
                        List <Model.account_albums> ls = new List <Model.account_albums>();
                        for (int j = 0; j < albumArr.Length; j++)
                        {
                            string[] imgArr = albumArr[j].Split('|');
                            if (imgArr.Length == 3)
                            {
                                if (!string.IsNullOrEmpty(link_urlArr[j]))
                                {
                                    ls.Add(new Model.account_albums {
                                        original_path = imgArr[1], thumb_path = imgArr[2], link_url = link_urlArr[j]
                                    });
                                }
                                if (!string.IsNullOrEmpty(remarkArr[j]))
                                {
                                    ls.Add(new Model.account_albums {
                                        original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[j]
                                    });
                                }
                                else
                                {
                                    ls.Add(new Model.account_albums {
                                        original_path = imgArr[1], thumb_path = imgArr[2]
                                    });
                                }
                            }
                        }
                        model.albums = ls;
                    }
                    #endregion
                    if (bll.Add(model) > 0)
                    {
                        //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加记账信息:" + model.name); //记录日志
                        successCount++;
                    }
                }
            }
            return(successCount);
        }