Exemple #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();
        }
    }
Exemple #2
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"]);
         BorrowApplication borrow = BorrowApplicationManager.Get(id);
         this.txtApplyNum.Text     = borrow.BAID.ToString();
         this.txtBATime.Value      = borrow.BATime;
         this.txtExigentGrade.Text = borrow.ExigentGrade;
         this.txtUser.Text         = borrow.User.Name;
         this.txtMark.Text         = borrow.BARemark;
         this.txtExamine.Text      = borrow.IsExamine;
         ucPager_onLoadPageIndexChaning(ucPager.PageIndex);
     }
 }
        public static IList <BorrowApplication> SearchBorrowApplication(int baid, int type, string time, int uid)
        {
            UserInfo user = new UserInfo();

            user.UID = uid;
            BorrowApplication item = new BorrowApplication(baid, user, time, type, "", "", "");

            return(borrowService.GetAllBorrowApplication(item));
        }
        object IDAL.IBaseFace.Get(int id)
        {
            BorrowApplication item = null;

            using (SqlDataReader reader = DBHelper.ExecuteReaderProc(GET_BORROWAPPLICATION, new SqlParameter("@BAID", id)))
            {
                if (reader.Read())
                {
                    item = new BorrowApplication(reader.GetInt32(0), (UserInfo)uis.GetAllUserById(reader.GetInt32(1)), reader.GetDateTime(2).ToString(), reader.GetInt32(3), reader.GetString(4), reader.GetString(5), reader.GetString(6));
                }
            }
            return(item);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int id = Convert.ToInt32(this.Request.QueryString["id"]);
         BorrowApplication borrow = BorrowApplicationManager.Get(id);
         this.txtBorrowNo.Text     = borrow.BAID.ToString();
         this.txtBATime.Value      = borrow.BATime;
         this.txtExigentGrade.Text = borrow.ExigentGrade;
         this.txtUser.Text         = borrow.User.Name;
         this.txtMark.Text         = borrow.BARemark;
         this.txtExamine.Text      = borrow.IsExamine;
     }
 }
Exemple #6
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
         {
             BorrowApplication borrow = new BorrowApplication();
             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 = BorrowApplicationManager.Add(borrow);
             borrow.BAID = id;
             Hashtable list = ApplicationResources.GetItems;
             foreach (int str in list.Keys)
             {
                 ApplicationResourseInfo item = (ApplicationResourseInfo)list[str];
                 item.Borrow = borrow;
                 ApplicationResourceManager.add(item);
             }
             list.Clear();
             Response.Redirect("ApplyBorrowList.aspx");
         }
     }
 }
        int IDAL.IBaseFace.Add(object obj)
        {
            int val = 0;

            if (obj is BorrowApplication)
            {
                BorrowApplication item  = (BorrowApplication)obj;
                SqlParameter[]    parms = new SqlParameter[]
                {
                    new SqlParameter("@UID", item.User.UID),
                    new SqlParameter("@BATime", item.BATime),
                    new SqlParameter("@BAType", item.BAType),
                    new SqlParameter("@ExigentGrade", item.ExigentGrade),
                    new SqlParameter("@BARemark", item.BARemark),
                    new SqlParameter("@IsExamine", item.IsExamine)
                };
                val = DBHelper.ExecuteScalarProc(ADD_BORROWAPPLICATION, parms);
            }
            return(val);
        }
        IList <BorrowApplication> IBorrowApplicationService.GetAllBorrowApplication(BorrowApplication item)
        {
            IList <BorrowApplication> items = new List <BorrowApplication>();

            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@BAID", item.BAID),
                new SqlParameter("@UID", item.User.UID),
                new SqlParameter("@BATime", item.BATime),
                new SqlParameter("@BAType", item.BAType),
                new SqlParameter("@ExigentGrade", item.ExigentGrade),
                new SqlParameter("@BARemark", item.BARemark),
                new SqlParameter("@IsExamine", item.IsExamine)
            };
            using (SqlDataReader reader = DBHelper.ExecuteReaderProc(SEARCH_BORROWAPPLICATION, parms))
            {
                while (reader.Read())
                {
                    BorrowApplication var = new BorrowApplication(reader.GetInt32(0), (UserInfo)uis.GetAllUserById(reader.GetInt32(1)), reader.GetDateTime(2).ToString(), reader.GetInt32(3), reader.GetString(4), reader.GetString(5), reader.GetString(6));
                    items.Add(var);
                }
            }
            return(items);
        }
Exemple #9
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);
        }
    }
 public static int Update(BorrowApplication item)
 {
     return(borrowService.Update(item));
 }
 public static int Add(BorrowApplication item)
 {
     return(borrowService.Add(item));
 }