protected void Page_Load(object sender, EventArgs e)
 {
     Response.BufferOutput = true;
     Authentication auth = new Authentication(this);
     if (auth.LoadSession() == false)
     {
         auth.RemoveSession();
         Response.Redirect("../../UI/FrameUI/login.htm");
         Response.End();
     }
     else
     {
         m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
         if (CheckAccessAble())
         {
             if (!IsPostBack)
             {
                 DdlProjectBind();
             }
         }
         else
         {
             auth.RemoveSession();
             Response.Redirect("../../UI/FrameUI/login.htm");
             Response.End();
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.BufferOutput = true;
     Authentication auth = new Authentication(this);
     if (auth.LoadSession() == false)
     {
         auth.RemoveSession();
         Response.Redirect("../../UI/FrameUI/login.htm");
         Response.End();
     }
     else
     {
         if (((Authentication.LOGININFO)Session["USERINFO"]).Admin=="1")
         {
             DdlUserBind();
             if (!IsPostBack)
             {
                 DdlGroupBind();
             }
         }
         else
         {
             auth.RemoveSession();
             Response.Redirect("../../UI/FrameUI/login.htm");
             Response.End();
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
                if(CheckAccessAble())
                {
                    if (!IsPostBack)
                    {
                        req_id.Value = Misc.GetHtmlRequestValue(Request, "id");
                        objid.Value = Misc.GetHtmlRequestValue(Request, "objid");
                        rowversion.Value = Misc.GetHtmlRequestValue(Request, "ver");

                        DemandRequisition m_req = new DemandRequisition(Misc.GetHtmlRequestValue(Request, "id"));
                        if (m_req.REQUISITION_ID == "")
                        {
                            this.ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script>alert('����δ�ҵ���');window.opener.__doPostBack('BtnQuery','');window.close();</script>");
                        }
                        else
                        {
                            if (m_req.ROWSTATE != "init")
                            {
                                this.ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script>alert('����״̬�Ѹı䣬�����޸ģ�');window.opener.__doPostBack('BtnQuery','');window.close();</script>");
                            }
                            else
                            {
                                DdlProdSiteBind();
                                DdlReceiptDeptBind();
                                DdlReceiptPersonBind();
                                contract.InnerText = m_req.CONTRACT;
                                part_no.InnerText = m_req.PART_NO;
                                part_desc.InnerText = m_req.PART_DESCRIPTION;
                                project_id.InnerText = m_req.PROJECT_ID;
                                project_desc.InnerText = m_req.PROJECT_DESCRIPTION;
                                mtr_seq_no.InnerText = m_req.MATR_SEQ_NO;
                                mtr_line_no.InnerText = m_req.MATR_SEQ_LINE_NO;
                                ration_qty.InnerText = DBHelper.getObject(string.Format("select ration_qty from IFSAPP.PROJ_PROCU_RATION@erp_prod where misc_tab_ref_no='{0}' and material_req_seq_no='{1}'", m_req.MATR_SEQ_NO, m_req.MATR_SEQ_LINE_NO)).ToString();
                                issued_qty.InnerText = DBHelper.getObject(string.Format("select nvl(issued_qty,0) from IFSAPP.PROJ_PROCU_RATION@erp_prod where misc_tab_ref_no='{0}' and material_req_seq_no='{1}'", m_req.MATR_SEQ_NO, m_req.MATR_SEQ_LINE_NO)).ToString();
                                required_qty.InnerText = (Convert.ToDecimal(DBHelper.getObject(string.Format("select jp_requisition_api.get_required_num_of_mtr('{0}','{1}') from dual", m_req.MATR_SEQ_NO, m_req.MATR_SEQ_LINE_NO))) - Convert.ToDecimal(m_req.REQUIRE_QTY)).ToString();

                                DdlProdSite.SelectedIndex = DdlProdSite.Items.IndexOf(DdlProdSite.Items.FindByValue(m_req.PLACE));
                                DDL_QH.SelectedIndex = DDL_QH.Items.IndexOf(DDL_QH.Items.FindByValue(m_req.LACK_TYPE));
                                DdlReceiptDept.SelectedIndex = DdlReceiptDept.Items.IndexOf(DdlReceiptDept.Items.FindByValue(m_req.RECEIPT_DEPT));
                                TxtDate.Text = m_req.RECEIVE_DATE;
                                DdlReceiptPerson.SelectedIndex  = DdlReceiptPerson.Items.IndexOf(DdlReceiptPerson.Items.FindByText(m_req.RECEIVER));
                                TxtIC.Text = m_req.RECEIVER_IC;
                                TxtContact.Text = m_req.RECEIVER_CONTACT;
                                TxtBlock.Text = m_req.PROJECT_BLOCK;
                                TxtSystem.Text = m_req.PROJECT_SYSTEM;
                                ChkDz.Checked = m_req.CRANE == "1" ? true : false;
                                TxtRequireQty.Text = m_req.REQUIRE_QTY;
                                TxtWorkContent.Text = m_req.WORK_CONTENT;
                            }
                        }
                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;
            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
                if (CheckAccessAble())
                {
                    if (!IsPostBack)
                    {
                        string id_ = Server.HtmlDecode(Misc.GetHtmlRequestValue(Request, "id"));
                        string objid_ = Misc.GetHtmlRequestValue(Request, "objid");
                        string rowversion_ = Server.HtmlDecode(Misc.GetHtmlRequestValue(Request, "ver"));
                        string packageNo_ = Server.HtmlDecode(Misc.GetHtmlRequestValue(Request, "pkg"));
                        string partNo_ = Server.HtmlDecode(Misc.GetHtmlRequestValue(Request, "part"));
                        decimal releaseQty_ = Convert.ToDecimal(Server.HtmlDecode(Misc.GetHtmlRequestValue(Request, "qty")));
                        decimal issueQty_ = Misc.DBStrToNumber(Server.HtmlDecode(Misc.GetHtmlRequestValue(Request, "iss")));

                        GenPkgPart pkg = new GenPkgPart(packageNo_, partNo_);

                        LblReqId.Text = id_;
                        LblPackageNo.Text = packageNo_;
                        LblPackageName.Text = pkg.PackageName;
                        LblPartNo.Text = partNo_;
                        LblPartName.Text = pkg.PartNameE;
                        LblPartSpec.Text = pkg.PartSpec;
                        LblReleasedQty.Text = releaseQty_.ToString();
                        LblIssuedQty.Text = issueQty_.ToString();

                        HiddenObjid.Value = objid_;
                        HiddenRowversion.Value = rowversion_;

                        GVDataDataBind(packageNo_, partNo_);
                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;

            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;

                if (CheckAccessAble())
                {
                    if (!IsPostBack)
                    {
                        divCreateJjd.Visible = true;
                        divReqData.Visible = false;

                        BtnJoinJjd.Disabled = true;
                        BtnNewJjd.Enabled = false;
                        divJjdDisplay.Visible = false;
                        divJjdQuery.Visible = false;

                        DdlProjectDataBind();
                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;
            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
                if (CheckAccessAble())
                {
                    if (!IsPostBack)
                    {
                        string req_id_ = Misc.GetHtmlRequestValue(Request, "id");
                        objid.Value = Misc.GetHtmlRequestValue(Request, "objid");
                        rowversion.Value = Misc.GetHtmlRequestValue(Request, "ver");

                        PkgRequisition m_req = new PkgRequisition(req_id_);

                        if (m_req.RequisitionId == "")
                        {
                            //this.ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script>alert('����δ�ҵ���');window.opener.__doPostBack('BtnQuery','');window.close();</script>");
                            Misc.Message(this.GetType(), ClientScript, "��������δ�ҵ���");
                            Misc.RegisterClientScript(this.GetType(), "opener_shx", ClientScript, "<script type='text/javascript'>window.opener.__doPostBack('BtnQuery','');window.close();</script>");
                            return;
                        }
                        else
                        {
                            if (m_req.RowState != "init")
                            {
                                //this.ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script>alert('����״̬�Ѹı䣬�����޸ģ�');window.opener.__doPostBack('BtnQuery','');window.close();</script>");
                                Misc.Message(this.GetType(), ClientScript, "����״̬�Ѹı䣬�����޸ġ�");
                                Misc.RegisterClientScript(this.GetType(), "opener_shx", ClientScript, "<script>window.opener.__doPostBack('BtnQuery','');window.close();</script>");
                            }
                            else
                            {
                                GenPkgPart m_pkg_part = new GenPkgPart(m_req.PackageNo, m_req.PartNo);

                                DdlProdSiteBind();
                                DdlReceiptDeptBind();
                                DdlReceiptPersonBind();

                                requisition_id.InnerText = m_req.RequisitionId;
                                project_id.InnerText = m_req.ProjectId;
                                project_desc.InnerText = m_pkg_part.ProjectName;
                                package_no.InnerText = m_req.PackageNo;
                                package_name.InnerText = m_req.PackageName;
                                part_no.InnerText = m_req.PartNo;
                                part_name.InnerText = m_req.PartNameE;
                                onhand_qty.InnerText = m_pkg_part.OnhandQty.ToString();
                                avai_qty.InnerText = Convert.ToString(m_pkg_part.AvaiQty + m_req.RequireQty);
                                reserved_qty.InnerText = Convert.ToString(m_pkg_part.ReservedQty - m_req.RequireQty);

                                DdlProdSite.SelectedIndex = DdlProdSite.Items.IndexOf(DdlProdSite.Items.FindByValue(m_req.PlaceId));
                                DdlReceiptDept.SelectedIndex = DdlReceiptDept.Items.IndexOf(DdlReceiptDept.Items.FindByValue(m_req.ReceiptDept));
                                TxtDate.Text = m_req.ReceiptDateStr;
                                DdlReceiptPerson.SelectedIndex = DdlReceiptPerson.Items.IndexOf(DdlReceiptPerson.Items.FindByText(m_req.Receiver));
                                TxtIC.Text = m_req.ReceiverIc;
                                TxtContact.Text = m_req.ReceiverContract;
                                TxtBlock.Text = m_req.ProjectBlock;
                                TxtSystem.Text = m_req.ProjectSystem;
                                ChkDz.Checked = m_req.Crance == "1" ? true : false;
                                ChkPS.Checked = m_req.Psflag == "1" ? true : false;
                                TxtRequireQty.Text = m_req.RequireQty.ToString();
                                TxtWorkContent.Text = m_req.WorkContent;
                            }
                        }
                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;
            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
                if (CheckAccessAble())
                {
                    if (!IsPostBack)
                    {
                        divJjdQuery.Visible = true;
                        divJjdDisplay.Visible = false;

                        DdlQReceiptPlaceDataBind();
                        DdlQReceiptDeptDataBind();
                        dataBox.Visible = false;
                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;
            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                if (((Authentication.LOGININFO)Session["USERINFO"]).Admin == "1")
                {
                    if (!IsPostBack)
                    {
                        BtnSetPer.Enabled = false;
                        GVCurrPer.Visible = false;
                        GVAllPer.Visible = false;
                        Pnl.Visible = false;
                        string user = Misc.GetHtmlRequestValue(Request, "id");
                        DdlUserDataBind();
                        if (user != "")
                        {
                            DdlUser.SelectedIndex = DdlUser.Items.IndexOf(DdlUser.Items.FindByValue(user));
                            GVCurrPerDataBind(user);
                        }

                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;
            Authentication auth = new Authentication(this);
            if (auth.LoadSession() == false)
            {
                auth.RemoveSession();
                Response.Redirect("../../UI/FrameUI/login.htm");
                Response.End();
            }
            else
            {
                m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
                if (CheckAccessAble())
                {
                    if (!IsPostBack)
                    {
                        bindDDLData();
                        string partNo = Misc.GetHtmlRequestValue(Request, "part");
                        string packageNo = Misc.GetHtmlRequestValue(Request, "pkg");

                        if (partNo == "" || packageNo == "")
                        {
                            Misc.Message(this.GetType(), ClientScript, "ҳ�����ʧ�ܣ�δ��ñ�Ҫ������");
                            return;
                        }

                        LblPartNo.Text = partNo;
                        LblPackageNo.Text = packageNo;

                        GenPkgPartBase objPart = new GenPkgPartBase(packageNo, partNo);

                        LblPackageName.Text = objPart.PackageName;
                        TxtPartName.Text = objPart.PartName;
                        TxtPartNameE.Text = objPart.PartNameE;
                        TxtPartSpec.Text = objPart.PartSpec;
                        TxtDecNo.Text = objPart.DecNo;
                        TxtContractNo.Text = objPart.ContractNo;
                        DdlUnit.SelectedIndex = DdlUnit.Items.IndexOf(DdlUnit.Items.FindByValue(objPart.Unit));
                        TxtPO.Text = objPart.PO;
                        ChkPayFlag.Checked = objPart.PayFlag == "1" ? true : false;
                        m_picpath = objPart.PicPath;

                        HiddenObjId.Value = objPart.ObjId;
                        HiddenRowversion.Value = objPart.ObjVersion;
                        //TextBox1.Text = Request.Url.ToString();
                    }
                }
                else
                {
                    auth.RemoveSession();
                    Response.Redirect("../../UI/FrameUI/login.htm");
                    Response.End();
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.BufferOutput = true;
     Authentication auth = new Authentication(this);
     if (auth.LoadSession() == false)
     {
         auth.RemoveSession();
         Response.Redirect("../../UI/FrameUI/login.htm");
         Response.End();
     }
     else
     {
         m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission;
         if (CheckAccessAble())
         {
             if (!IsPostBack)
             {
                 DdlProdSiteBind();
                 DdlReceiptDeptBind();
                 DdlProjectDataBind();
                 DdlReqGroupDataBind();
                 //for (int i = 0; i < DdlProdSite.Items.Count; i++)
                 //{
                 //    DdlProdSite.Items[i].Attributes.Add("title", DdlProdSite.Items[i].Text);
                 //}
                 PreQuery();
             }
         }
         else
         {
             auth.RemoveSession();
             Response.Redirect("../../UI/FrameUI/login.htm");
             Response.End();
         }
     }
 }