示例#1
0
    protected void txtBorrowNo_TextChanged(object sender, EventArgs e)
    {
        ddlName.Items.Clear();
        int borrowNo = Convert.ToInt32(this.txtBorrowNo.Text.Trim());
        IList <ApplicationResourseInfo> ari       = new List <ApplicationResourseInfo>();
        IList <ResourceInfo>            resources = new List <ResourceInfo>();

        ari = ApplicationResourceManager.GetAllApplicationResource(1, borrowNo);
        foreach (ApplicationResourseInfo item in ari)
        {
            if (item.Borrow != new BorrowApplication())
            {
                resources.Add(item.Resource);
            }
        }
        this.ddlName.DataSource = resources;
        ddlName.DataTextField   = "RIName";
        ddlName.DataValueField  = "RIID";
        ddlName.DataBind();
        BorrowApplication borrow = BorrowApplicationManager.Get(borrowNo);

        if (borrow != new BorrowApplication() && borrow != null)
        {
            this.txtUser.Text = borrow.User.Name;
            this.hfUID.Value  = borrow.User.UID.ToString();
        }
    }
示例#2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         SpoilageRegister item = new SpoilageRegister();
         item.Borrow.BAID   = Convert.ToInt32(this.txtBorrowNo.Text.Trim());
         item.User.UID      = Convert.ToInt32(this.hfUID.Value.Trim());
         item.Resourse.RIID = Convert.ToInt32(this.ddlName.SelectedValue);
         item.SRNo          = Convert.ToInt32(this.txtPreNum.Text.Trim());
         item.SRGrade       = this.txtGrade.Text.Trim();
         item.SRCause       = this.txtCause.Text.Trim();
         item.SRTime        = txtDrawTime.Value.Trim();
         item.SRRemark      = txtRemark.Text.Trim();
         ApplicationResourseInfo resource = ApplicationResourceManager.GetApplicationResourse(item.Borrow.BAID, item.Resourse.RIID);
         ResourceRestore         restore  = ResourceRestoreManager.GetRestoreByBAIDAndRIID(item.Borrow.BAID, item.Resourse.RIID);
         if (restore != new ResourceRestore() && restore != null)
         {
             if (item.SRNo > resource.Number - restore.RRNumber)
             {
                 ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('您输入损耗数量超出了需要归还的数量!')</script>");
                 return;
             }
         }
         SpoilageRegisterManager.Add(item);
         Response.Redirect("UseList.aspx");
     }
 }
示例#3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         ResourceRestore restore = new ResourceRestore();
         restore.Borrow.BAID   = Convert.ToInt32(txtBorrowNo.Text.Trim());
         restore.Resource.RIID = Convert.ToInt32(ddlName.SelectedValue);
         restore.User.UID      = Convert.ToInt32(hfUID.Value);
         restore.RRTime        = txtTime.Value.Trim();
         restore.RRNumber      = Convert.ToInt32(txtRebackNum.Text.Trim());
         ApplicationResourseInfo appResource = ApplicationResourceManager.GetApplicationResourse(restore.Borrow.BAID, restore.Resource.RIID);
         if (restore.RRNumber > appResource.Number)
         {
             ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('您的输入归还数量有误!')</script>");
             return;
         }
         restore.RRRemark = txtMark.Text.Trim();
         if (ResourceRestoreManager.Add(restore) != 0)
         {
             restore.Resource         = ResourceInfoManager.Get(restore.Resource.RIID);
             restore.Resource.Number += restore.RRNumber;
             ResourceInfoManager.UpdateResourceInfo(restore.Resource);
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('录入成功!')</script>");
         }
         Response.Redirect("UseList.aspx");
     }
 }
示例#4
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     int[] baids = new int[gvUseList.Rows.Count];
     int[] riids = new int[gvUseList.Rows.Count];
     for (int a = 0; a < gvUseList.Rows.Count; a++)
     {
         if ((gvUseList.Rows[a].FindControl("cbCheck") as CheckBox).Checked)
         {
             baids[a] = Convert.ToInt32((gvUseList.Rows[a].FindControl("lblBAID") as Label).Text.Trim());
             riids[a] = Convert.ToInt32((gvUseList.Rows[a].FindControl("lblRIID") as Label).Text.Trim());
         }
     }
     for (int i = 0; i < baids.Length; i++)
     {
         if (baids[i] != 0 && riids[i] != 0)
         {
             ApplicationResourceManager.Delete(baids[i], 1, riids[i]);
             IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(1, baids[i]);
             if (items.Count == 0 || items == null)
             {
                 BorrowApplicationManager.DeleteById(baids[i]);
             }
         }
     }
     ucPager_onLoadPageIndexChaning(ucPager.PageIndex);
 }
示例#5
0
        public static string GetString(string resourceName)
        {
            if (_resource == null)
            {
                _resource = new ApplicationResourceManager(ApplicationName, Assembly.GetExecutingAssembly());
            }

            return(_resource.GetString(resourceName));
        }
示例#6
0
 private void OnFindCustomerTriggered(object sender, EventArgs e)
 {
     if (!TabExists("FindCustomer"))
     {
         TabItem tab = new TabItem();
         tab.Header         = ApplicationResourceManager.GetRessourcesValue("Find_Customer");
         tab.Name           = "FindCustomer";
         tab.HeaderTemplate = TabControl.FindResource("TabHeader") as DataTemplate;
         tab.Content        = new FindCustomerView();
         TabControl.Items.Insert(0, tab);
         TabControl.SelectedIndex = 0;
     }
 }
示例#7
0
    void ucPager_onLoadPageIndexChaning(int pageIndex)
    {
        PagedDataSource page = new PagedDataSource();

        page.DataSource               = ApplicationResourceManager.GetAllApplicationResource(1, Convert.ToInt32(Request.QueryString["id"]));
        ucPager.DataCount             = page.Count;
        page.AllowPaging              = true;
        page.PageSize                 = 5;
        page.CurrentPageIndex         = pageIndex;
        ucPager.PageCount             = page.PageCount;
        gvBorrowResource.DataSourceID = null;
        gvBorrowResource.DataSource   = page;
        gvBorrowResource.DataBind();
    }
示例#8
0
    void ucPager_onLoadPageIndexChaning(int pageIndex)
    {
        PagedDataSource page = new PagedDataSource();

        page.DataSource        = ApplicationResourceManager.SearchByResourceNameAndBorrowType(txtName.Text.Trim(), Convert.ToInt32(ddlType.SelectedValue));
        ucPager.DataCount      = page.Count;
        page.AllowPaging       = true;
        page.PageSize          = 10;
        page.CurrentPageIndex  = pageIndex;
        ucPager.PageCount      = page.PageCount;
        gvUseList.DataSourceID = null;
        gvUseList.DataSource   = page;
        gvUseList.DataBind();
    }
示例#9
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");
         }
     }
 }
示例#10
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);
        }
    }