Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ucPager.onLoadPageIndexChaning += new _Controls_Pager.MyDele(ucPager_onLoadPageIndexChaning);
     if (!IsPostBack)
     {
         UserInfo user = new UserInfo();
         if (Session["user"] != null)
         {
             user = (UserInfo)Session["user"];
             this.txtUser.Text = ((UserInfo)Session["user"]).Name; //"单哥!HOW ARE YOU?";
         }
         else
         {
             Response.Redirect("../login.aspx");
             return;
         }
         int id = Convert.ToInt32(this.Request.QueryString["id"]);
         StockApplication stock = StockApplicationManager.Get(id);
         this.txtSAID.Text       = stock.SAID.ToString();
         this.txtUser.Text       = stock.User.Name;
         this.txtTime.Value      = stock.SATime;
         this.txtNeedCharge.Text = stock.NeedCharge.ToString();
         this.txtCause.Text      = stock.SACause;
         this.txtMark.Text       = stock.SARemark;
         this.txtIsExamine.Text  = stock.IsExamine;
         ucPager_onLoadPageIndexChaning(ucPager.PageIndex);
     }
 }
Пример #2
0
    void ucpage_onLoadPageIndexChaning(int pageIndex)
    {
        UserInfo user = new UserInfo();

        if (Session["user"] != null)
        {
            user = (UserInfo)Session["user"];
        }
        else
        {
            Response.Redirect("../login.aspx");
            return;
        }
        hfLoginId.Value = user.UID.ToString();
        PagedDataSource page = new PagedDataSource();

        page.DataSource       = StockApplicationManager.SearchStockApplication(Convert.ToInt32(txtSAID.Text.Trim() == "" ? "0" : txtSAID.Text.Trim()), txtSATime.Value.Trim(), user.UID);
        ucpage.DataCount      = page.Count;
        page.AllowPaging      = true;
        page.PageSize         = 10;
        page.CurrentPageIndex = pageIndex;
        ucpage.PageCount      = page.PageCount;
        gvStockApplicationList.DataSourceID = null;
        gvStockApplicationList.DataSource   = page;
        gvStockApplicationList.DataBind();
    }
Пример #3
0
 protected void gvStockApplicationList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         int val = StockApplicationManager.DeleteById(Convert.ToInt32(e.CommandArgument));
         if (val != 0)
         {
             this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('删除成功')</script>");
             BorrowBind(0, "");
         }
     }
 }
Пример #4
0
    private void BorrowBind(int said, string satime)
    {
        UserInfo user = new UserInfo();

        if (Session["user"] != null)
        {
            user = (UserInfo)Session["user"];
        }
        gvStockApplicationList.DataSourceID = null;
        gvStockApplicationList.DataSource   = StockApplicationManager.SearchStockApplication(said, satime, user.UID);
        gvStockApplicationList.DataBind();
    }
Пример #5
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         UserInfo user = new UserInfo();
         if (Session["user"] != null)
         {
             user = (UserInfo)Session["user"];
         }
         else
         {
             Response.Redirect("../login.aspx");
             return;
         }
         if (ApplicationResources.GetItems.Count == 0)
         {
             this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('你还没有选择资源!')</script>");
             return;
         }
         else
         {
             StockApplication stock = new StockApplication();
             stock.User.UID   = user.UID;
             stock.SATime     = this.txtSATime.Value.Trim();
             stock.NeedCharge = Convert.ToDouble(this.txtNeedCharge.Text.Trim());
             stock.SACause    = this.txtSACause.Text.Trim();
             stock.SARemark   = this.txtMark.Text.Trim();
             stock.IsExamine  = "待办";
             //borrow.User.UID = ((UserInfo)Session["user"]).UID/*1*/;
             //borrow.BATime = this.txtBorrowTime.Value.Trim();
             //borrow.BAType = Convert.ToInt32(this.ddlType.SelectedValue);
             //borrow.ExigentGrade = this.txtExigentGrade.Text.Trim();
             //borrow.BARemark = this.txtMark.Text.Trim();
             //borrow.IsExamine = "未审批";
             int id = StockApplicationManager.Add(stock);
             stock.SAID = id;
             Hashtable list = ApplicationResources.GetItems;
             foreach (int str in list.Keys)
             {
                 ApplicationResourseInfo item = (ApplicationResourseInfo)list[str];
                 item.Stock = stock;
                 ApplicationResourceManager.add(item);
             }
             list.Clear();
             Response.Redirect("ApplyStockList.aspx");
         }
     }
 }
Пример #6
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     int[] ids = new int[gvStockApplicationList.Rows.Count];
     for (int a = 0; a < gvStockApplicationList.Rows.Count; a++)
     {
         if ((gvStockApplicationList.Rows[a].FindControl("cbCheck") as CheckBox).Checked)
         {
             ids[a] = Convert.ToInt32(gvStockApplicationList.Rows[a].Cells[1].Text.Trim());
         }
     }
     foreach (int said in ids)
     {
         if (said != 0)
         {
             StockApplicationManager.DeleteById(said);
         }
     }
     BorrowBind(0, "");
 }
Пример #7
0
    /// <summary>
    /// 添加审批记录
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Examine em = new Examine();

        em.RequisitionID   = Convert.ToInt32(txtApplicationId.Text);
        em.RequisitionType = txtType.Text;
        em.ExamineUID.UID  = Convert.ToInt32(((UserInfo)Session["user"]).UID);
        em.ExamineIdea     = this.txtCause.Text;
        em.EndTime         = Convert.ToDateTime(txtTime.Value);
        em.IsApproved      = rdoAccess.SelectedValue == "未过" ? "未过" : "通过";

        //不管是否通过,都在审批记录表中添加一条审批记录
        if (ExamineManager.AddExamine(em) > 0)
        {
            //判断审批是否通过,
            if (rdoAccess.SelectedValue == "通过")
            {
                if (txtType.Text == "会议申请")
                {
                    try
                    {
                        MeetingApplication ma = MeetingApplicationManager.GetMeetingApplicationById(Convert.ToInt32(txtApplicationId.Text));
                        //获取所有与会人员,
                        string applicationMan = ma.WithinEnlistMan;

                        LeaveWord lw = new LeaveWord();
                        lw.MsgTitle         = ma.MeetTitle;                                         //会议标题
                        lw.MsgContent       = ma.MeetContent;                                       //会议内容
                        lw.MsgSendTime      = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //发送时间
                        lw.MsgState         = "未读";
                        lw.MsgTypeId.Id     = 1;                                                    //1代表会议申请
                        lw.SenderUser       = user;                                                 //发送者
                        lw.MeetingBeginTime = ma.BeginTime;                                         //开会时间
                        lw.MeetingAddr      = ma.RoomInfo.RomeAddr;                                 //会议地点
                        lw.ChargeMan        = ma.Compere;                                           //会议负责人
                        lw.MeetingType      = ma.MeetType;

                        //用“,”号分割与会人员
                        string[] array = applicationMan.Split(new char[] { ',' });
                        for (int i = 0; i < array.Length; i++)
                        {
                            int uid = UserInfoManager.GetLeaveIDByMName(array[i]);
                            lw.ReceiverUser.UID = uid;
                            int flag = LeaveWordManager.AddLeaveWord(lw);
                        }
                        //更新会议申请的状态
                        MeetingApplicationManager.ModifyMeetingState(Convert.ToInt32(txtApplicationId.Text), "已办");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true);
                    }
                    catch (Exception)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true);
                        return;
                    }
                }
                else if (txtType.Text == "用车申请")
                {
                    try
                    {
                        //更新用车申请状态
                        int flag = CarByapplyManager.UpadteByapplySate(Convert.ToInt32(txtApplicationId.Text), "已办");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true);
                    }
                    catch (Exception)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true);
                        return;
                    }
                }
            }
            else   //不通过,终结申请
            {
                if (txtType.Text == "会议申请")
                {
                    MeetingApplicationManager.ModifyMeetingState(Convert.ToInt32(txtApplicationId.Text), "终结");
                }
                else if (txtType.Text == "用车申请")
                {
                    //终结用车申请
                    int flag = CarByapplyManager.UpadteByapplySate(Convert.ToInt32(txtApplicationId.Text), "终结");
                }


                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('已终结!');window.location='Matter.aspx'</script>", true);
            }



            if (txtType.Text == "任务申请") //根据实际完成金额更新任务总体完成进度
            {
                try
                {
                    if (em.IsApproved == "通过")
                    {
                        TaskManager.UpdateTaskNowStatus(Convert.ToInt32(txtApplicationId.Text));//更新任务状态
                        //更新任务的完成比例
                        TaskManager.UpdateTaskFinshStatus(Convert.ToInt32(txtApplicationId.Text));

                        //更新申请单状态为通过
                        new RolePowerManager().UpdatePaddingStatus("已办", Convert.ToInt32(txtApplicationId.Text.Trim()));
                    }
                    else
                    {
                        //更新申请单状态为终结
                        new RolePowerManager().UpdatePaddingStatus("终结", Convert.ToInt32(txtApplicationId.Text.Trim()));
                    }
                }
                catch (Exception)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('更新任务状态失败!');", true);
                    return;
                }
            }
            if (txtType.Text == "资源采购")
            {
                StockApplication stock = StockApplicationManager.Get((int)em.RequisitionID);
                if (em.IsApproved == "通过")
                {
                    stock.IsExamine = "已办";
                    IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(2, stock.SAID);
                    foreach (ApplicationResourseInfo item in items)
                    {
                        item.Resource.Number += item.Number;
                        ResourceInfoManager.UpdateResourceInfo(item.Resource);
                    }
                }
                else
                {
                    stock.IsExamine = "终结";
                }
                StockApplicationManager.Update(stock);
            }
            else if (txtType.Text == "资源借用")
            {
                BorrowApplication borrow = BorrowApplicationManager.Get((int)em.RequisitionID);
                if (em.IsApproved == "通过")
                {
                    borrow.IsExamine = "已办";
                    IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(1, borrow.BAID);
                    foreach (ApplicationResourseInfo item in items)
                    {
                        item.Resource.Number -= item.Number;
                        ResourceInfoManager.UpdateResourceInfo(item.Resource);
                    }
                }
                else
                {
                    borrow.IsExamine = "终结";
                }
                BorrowApplicationManager.Update(borrow);
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true);
            // Response.Redirect("");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true);
        }
    }