Exemplo n.º 1
0
        /// <summary>
        ///点击确定按钮触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                string strLimitNums = (this.ddlCardName.SelectedItem.Text.Split(',')[1]).Split(']')[0];//cash表纪录的金额
                strLimitNums = strLimitNums.Split(':')[1];
                double dLimitNums     = double.Parse(strLimitNums);
                string strApplyCount  = this.txtApplyCount.Text;
                double dApplyCount    = double.Parse(strApplyCount);
                string strGetDateTime = this.txtGetDateTime.Value;
                //DateTime dTimeInput = new DateTime(Int32.Parse(strGetDateTime.Split('-')[0]), Int32.Parse(strGetDateTime.Split('-')[1]), Int32.Parse(strGetDateTime.Split('-')[2]), Int32.Parse(this.ddlHour.SelectedValue), Int32.Parse(this.ddlMin.SelectedValue), 0);
                DateTime dTimeInput = Convert.ToDateTime(strGetDateTime + RadioButtonList_shijian.SelectedValue.ToString());
                //用途
                string UserFor = this.txtUseFor.Text.Trim();
                if (RBlist_YYLX.SelectedValue == "1")
                {
                    if (dApplyCount > dLimitNums)
                    {
                        tag.Text = "申请数额不能超过所选资金卡的余额!";
                        return;
                    }
                }
                //用途拼接字符串
                UserFor = "[" + RBlist_YYLX.SelectedItem.Text + "]" + UserFor;

                if (Convert.ToDateTime(Convert.ToDateTime(strGetDateTime).ToString("yyyy-MM-dd")) < Convert.ToDateTime(DateTime.Now.AddDays(2).ToString("yyyy-MM-dd")))
                {
                    tag.Text = "经费预约必须提前二天,请电话联系相关人员!";
                    return;
                }
                mCash_Apply                   = new Dianda.Model.Cash_Apply();
                mCash_Apply.ProjectID         = Int32.Parse(this.ddlProjectID.SelectedValue);
                mCash_Apply.CashCertificateID = this.ddlCardName.SelectedValue;
                mCash_Apply.ApplyCount        = decimal.Parse(strApplyCount);
                mCash_Apply.GetDateTime       = dTimeInput;
                mCash_Apply.UseFor            = UserFor;
                mCash_Apply.ApplierTel        = this.txtApplierTel.Text;
                mCash_Apply.ApplierID         = ((Model.USER_Users)Session["USER_Users"]).ID;
                mCash_Apply.DATETIME          = DateTime.Now;
                mCash_Apply.Statas            = 0;//(0-待审核、1表示审核通过、2表示审核不通过)
                mCash_Apply.DoUserID          = ((Model.USER_Users)Session["USER_Users"]).ID;

                bCash_Apply.Add(mCash_Apply);

                /*给业务申请者发信息*/
                Model.FaceShowMessage mFaceShowMessage = new Dianda.Model.FaceShowMessage();
                BLL.FaceShowMessage   bFaceShowMessage = new Dianda.BLL.FaceShowMessage();

                mFaceShowMessage.DATETIME  = DateTime.Now;
                mFaceShowMessage.FromTable = "经费预约";
                mFaceShowMessage.IsRead    = 0;
                mFaceShowMessage.NewsID    = null;
                mFaceShowMessage.NewsType  = "经费预约";
                mFaceShowMessage.ReadTime  = null;
                mFaceShowMessage.Receive   = "经费预约";
                mFaceShowMessage.ProjectID = Int32.Parse(this.ddlProjectID.SelectedValue);
                mFaceShowMessage.DELFLAG   = 0;
                //mFaceShowMessage.URLS = ((Model.USER_Users)Session["USER_Users"]).REALNAME + "(" + ((Model.USER_Users)Session["USER_Users"]).USERNAME.ToString() + ")经费预约<a href='/Admin/cashCardManage/manageCashApply.aspx' target='_self' title='经费预约:提交时间" + DateTime.Now + "'>点击处理</a>";
                mFaceShowMessage.URLS = "<a href='/Admin/cashCardManage/manageCashApply.aspx' target='_self' title='经费预约:提交时间" + DateTime.Now + "'>经费预约  金额 " + dApplyCount + "</a>" + "  " + dTimeInput + " (" + ((Model.USER_Users)Session["USER_Users"]).REALNAME + ")";
                bFaceShowMessage.Add(mFaceShowMessage);
                /*给业务申请者发信息*/

                Model.Cash_Cards mCash_Cards = new Dianda.Model.Cash_Cards();
                BLL.Cash_Cards   bCash_Cards = new Dianda.BLL.Cash_Cards();
                mCash_Cards = bCash_Cards.GetModel(Int32.Parse(this.ddlCardName.SelectedValue));



                //添加操作日志
                Dianda.BLL.SYS_LogsExt bsyslog    = new Dianda.BLL.SYS_LogsExt();
                Model.USER_Users       user_model = (Model.USER_Users)Session["USER_Users"];
                bsyslog.addlogs(((Model.USER_Users)Session["USER_Users"]).REALNAME + "(" + ((Model.USER_Users)Session["USER_Users"]).USERNAME + ")", "添加经费预约", "预约" + dTimeInput + "时间取" + strApplyCount + ":成功");
                //添加操作日志

                //tag.Text = "操作成功!";
                string coutws = "";
                if (parentpage == "manageCashApplyPerson")
                {
                    //  coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manageCashApplyPerson.aspx?pageindex=" + Request["pageindex"] + "&status=" + Request["status"] + "&parentpage=" + Request["parentpage"] + "\";</script>";
                    coutws = "alert(\"操作成功!现在进入列表页面\"); location.href = \"manageCashApplyPerson.aspx?pageindex=" + Request["pageindex"] + "&status=" + Request["status"] + "&parentpage=" + Request["parentpage"] + "\";";
                }
                else
                {
                    // coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manageCashApply.aspx?pageindex=" + Request["pageindex"] + "&status=" + Request["status"] + "\";</script>";
                    coutws = "alert(\"操作成功!现在进入列表页面\"); location.href = \"manageCashApply.aspx?pageindex=" + Request["pageindex"] + "&status=" + Request["status"] + "\";";
                }
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", coutws, true);
                //  Response.Write(coutws);
            }
            catch
            {
                tag.Text = "操作失败,请重试!";
            }
        }
        /// <summary>
        /// 点击重置按钮触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_reset_onclick(object sender, EventArgs e)
        {
            //选择编辑的条数只能为一条
            int num  = 0;
            int rows = GridView1.Rows.Count;

            if (rows > 0)
            {
                for (int i = 0; i < rows; i++)
                {
                    CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox_choose");
                    if (cb.Checked)
                    {
                        num = num + 1;
                    }
                }

                if (num == 0)
                {
                    tag.Text = "请选择要操作的纪录!";
                }
                else
                {
                    tag.Text = "";
                    string info = "";
                    for (int j = 0; j < rows; j++)
                    {
                        CheckBox cb1 = (CheckBox)GridView1.Rows[j].Cells[0].FindControl("CheckBox_choose");
                        // HiddenField hid = (HiddenField)GridView1.Rows[j].Cells[0].FindControl("Hid_ID");
                        string id = GridView1.DataKeys[j]["ID"].ToString();
                        string ApplierRealName = GridView1.DataKeys[j]["ApplierRealName"].ToString();
                        string GetDateTime     = GridView1.DataKeys[j]["GetDateTime"].ToString();
                        string ApplyCount      = GridView1.DataKeys[j]["ApplyCount"].ToString();

                        if (cb1.Checked)
                        {
                            mCash_Apply          = new Dianda.Model.Cash_Apply();
                            mCash_Apply          = bCash_Apply.GetModel(Int32.Parse(id));
                            mCash_Apply.Statas   = 2;
                            mCash_Apply.DoUserID = ((Model.USER_Users)Session["USER_Users"]).ID;
                            bCash_Apply.Update(mCash_Apply);
                            info    += ("(" + ApplierRealName + "申请额度" + ApplyCount + "在" + GetDateTime + ")");
                            tag.Text = "操作成功!";
                            // string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx?pageindex=" + Request["pageindex"] + "\";</script>";

                            Model.Cash_Cards mCash_Cards = new Dianda.Model.Cash_Cards();
                            BLL.Cash_Cards   bCash_Cards = new Dianda.BLL.Cash_Cards();
                            mCash_Cards = bCash_Cards.GetModel(Int32.Parse(mCash_Apply.CashCertificateID.ToString()));

                            /*给业务申请者发信息*/
                            Model.FaceShowMessage mFaceShowMessage = new Dianda.Model.FaceShowMessage();
                            BLL.FaceShowMessage   bFaceShowMessage = new Dianda.BLL.FaceShowMessage();

                            mFaceShowMessage.DATETIME  = DateTime.Now;
                            mFaceShowMessage.FromTable = "申请情况";
                            mFaceShowMessage.IsRead    = 0;
                            mFaceShowMessage.NewsID    = null;
                            mFaceShowMessage.NewsType  = "申请情况";
                            mFaceShowMessage.ReadTime  = null;
                            mFaceShowMessage.Receive   = mCash_Apply.ApplierID;
                            mFaceShowMessage.URLS      = "<a href='/Admin/cashCardManage/manageCashApplyPerson.aspx' target='_self' title='经费预约:提交时间" + DateTime.Now + "'>" + mCash_Cards.CardName + "的经费预约 审核不通过 </a>  (" + ((Model.USER_Users)Session["USER_Users"]).REALNAME + ")";
                            bFaceShowMessage.Add(mFaceShowMessage);
                            /*给业务申请者发信息*/
                        }
                    }

                    // 添加操作日志
                    Dianda.BLL.SYS_LogsExt bsyslog    = new Dianda.BLL.SYS_LogsExt();
                    Model.USER_Users       user_model = (Model.USER_Users)Session["USER_Users"];
                    bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "审核经费预约", "审核预约" + info + "不通过:成功");

                    string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manageCashApply.aspx?pageindex=" + pageindexHidden.Value + "&date=" + DDList_RQ.SelectedValue + "&status=" + this.ddlStatas.SelectedValue + "\";</script>";
                    Response.Write(coutws);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 点击确定触发事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_sumbit_onclick(object sender, EventArgs e)
        {
            try
            {
                //项目ID
                string projectid = Request["ID"];
                project_model = project_bll.GetModel(int.Parse(projectid.ToString()));
                Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"];
                string           checkvalue = RadioButtonList_Check.SelectedValue.ToString();
                string           flag       = "";

                string urls = "";           //接受审核通过和不通过的地址:审核通过,到项目文档中,审核不通过到只做提示

                if (checkvalue.Equals("1")) //表示审核通过
                {
                    flag = "审核通过";
                    //预算表单的审核状态
                    project_model.TEMP1 = "1";

                    //如果审核通过将上传的预算表单保存到项目的目录中
                    string    sql = "SELECT ID FROM Document_Folder WHERE (ProjectID = '" + projectid + "') AND (UpID = 38)  and delflag='0'";
                    DataTable dt  = pageControl.doSql(sql).Tables[0];

                    if (dt.Rows.Count > 0)
                    {
                        string id = dt.Rows[0]["ID"].ToString();
                        //如果审核通过将上传的预算表单保存到项目的目录中
                        if (null != project_model.BudgetList && !(project_model.BudgetList.ToString().Equals("")))
                        {
                            setAttachmentsToDocument(user_model.ID, id, project_model.BudgetList.ToString());
                        }
                    }

                    //选择资金卡
                    DataSet ds1 = cashmessage_bll.GetList(" ProjectID = " + project_model.ID);
                    DataSet ds2 = card_bll.GetList(" ProjectID = " + project_model.ID);

                    if (RB_CashCardID.Checked == true)//如果选择的是资金卡则设为资金卡的ID;
                    {
                        //如果在资金卡中以前本身就有该项目的。。则要将原来的该项目的资金卡的项目ID设空
                        if (ds2.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
                            {
                                Model.Cash_Cards card_model1 = new Dianda.Model.Cash_Cards();
                                BLL.Cash_Cards   card_bll1   = new Dianda.BLL.Cash_Cards();

                                string id = ds2.Tables[0].Rows[i]["ID"].ToString();
                                card_model1 = card_bll1.GetModel(int.Parse(id));

                                card_model1.ProjectID = null;
                                card_bll1.Update(card_model1);
                            }
                        }

                        //资金卡ID
                        string cashcardid = DDL_CashCardID.SelectedValue.ToString();
                        card_model = card_bll.GetModel(int.Parse(cashcardid));
                        //将资金卡表中的项目ID改成当前项目
                        card_model.ProjectID = int.Parse(projectid);

                        card_bll.Update(card_model);
                    }
                    else//如果选择的是新建资金卡则设为0,并且需要向cash_message表中加一条记录
                    {
                        project_model.CashCardID = 0;

                        //如果原来就有记录,则修改
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            //ID
                            string cashid = ds1.Tables[0].Rows[0]["ID"].ToString();
                            cashmessage_model = cashmessage_bll.GetModel(int.Parse(cashid));
                            //资金卡初始金额
                            cashmessage_model.LimitNums = Convert.ToDecimal(TB_LimitNums.Text);
                            //新建备注说明
                            cashmessage_model.Notes = TB_Notes.Text.ToString();

                            cashmessage_bll.Update(cashmessage_model);
                        }
                        else
                        {
                            //资金卡名称(暂时写的留空)
                            cashmessage_model.CardName = "";
                            //持卡人
                            cashmessage_model.CardholderID = project_model.SendUserID.ToString();
                            //项目的ID
                            cashmessage_model.ProjectID = project_model.ID;
                            //初始金额
                            cashmessage_model.LimitNums = Convert.ToDecimal(TB_LimitNums.Text.ToString());
                            //填写的时间
                            cashmessage_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToString());
                            //发出这个消息的用户的ID
                            cashmessage_model.SendUserID = user_model.ID;
                            //备注说明
                            cashmessage_model.Notes = TB_Notes.Text.ToString();
                            //是否已经阅读
                            cashmessage_model.IsRead = 0;
                            //消息的状态
                            cashmessage_model.Status = 1;

                            Session["Cash_Message_temps"] = cashmessage_model;

                            //向信息表中添加一条新建资金卡的记录
                            cashmessage_bll.Add(cashmessage_model);
                        }
                    }
                    BLL.Document_Folder          bllFolder  = new Dianda.BLL.Document_Folder();
                    List <Model.Document_Folder> folderlist = bllFolder.GetModelList("UpID='38' and Types='public' and ProjectID='" + projectid + "' and delflag='0'");
                    if (folderlist.Count > 0)
                    {
                        urls = "<a href='/Admin/DocumentManage/manage.aspx?CID=" + folderlist[0].COLUMNSPATH.ToString() + "&tp=1' target='_self' title='预算表单审核:审核时间" + DateTime.Now.ToString() + "'>" + project_model.NAMES.ToString() + "  预算表单  " + flag + "</a>";
                    }
                    else
                    {
                        urls = project_model.NAMES.ToString() + "  预算表单  " + flag;
                    }
                }
                else
                {
                    flag = "审核不通过";
                    //预算表单的审核状态
                    project_model.TEMP1 = "2";

                    urls = project_model.NAMES.ToString() + "  预算表单  " + flag;
                }

                project_bll.Update(project_model);


                //给业务申请者发信息
                Model.FaceShowMessage mFaceShowMessage = new Dianda.Model.FaceShowMessage();
                BLL.FaceShowMessage   bFaceShowMessage = new Dianda.BLL.FaceShowMessage();

                mFaceShowMessage.DATETIME  = DateTime.Now;
                mFaceShowMessage.FromTable = "申请情况";
                mFaceShowMessage.IsRead    = 0;
                mFaceShowMessage.NewsID    = null;
                mFaceShowMessage.NewsType  = "申请情况";
                mFaceShowMessage.ReadTime  = null;
                mFaceShowMessage.DELFLAG   = 0;
                mFaceShowMessage.ProjectID = project_model.ID;
                mFaceShowMessage.Receive   = project_model.SendUserID.ToString();//当前项目的创建人的ID
                mFaceShowMessage.URLS      = urls;

                //mFaceShowMessage.URLS = "<a href='/Admin/budgetManage/manage.aspx?role=manager&Status=" + project_model.TEMP1 + "' target='_self' title='预算表单审核:审核时间" + DateTime.Now.ToString() + "'>" + project_model.NAMES.ToString() + "  预算表单  " + flag + "</a>";

                bFaceShowMessage.Add(mFaceShowMessage);
                //给业务申请者发信息



                ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入列表页面');javascript:location='manage.aspx?pageindex=" + Request["pageindex"] + "&Status=" + Request["Status"] + "&role=manager';</script>", false);


                //添加操作日志

                Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt();
                bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "预算管理", project_model.NAMES + " 预约表单" + flag);

                //添加操作日志
            }
            catch
            {
            }
        }