private RequestStationeryControl GetControl()
 {
     if (resCtrl == null)
         resCtrl = new RequestStationeryControl();
     return resCtrl;
 }
        /// <summary>
        /// Loads the RequestStationery form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // click add to table
            if (Request.QueryString["itemCode"] != null)
            {
                resCtrl = (RequestStationeryControl)StationeryStoreInventorySystemController.Util.GetSession(sessionKey);

                if (resCtrl == null)
                {
                    resCtrl = GetControl();

                    StationeryStoreInventorySystemController.Util.PutSession(sessionKey, resCtrl);

                    lblRequisitionDate.Text = SystemStoreInventorySystemUtil.Converter.dateTimeToString(SystemStoreInventorySystemUtil.Converter.DATE_CONVERTER.DATETIME, DateTime.Now);
                    lblRequisitionID.Text = resCtrl.RequisitionId;
                    lblDepartmentCode.Text = resCtrl.DepartmentCode;
                    lblDepartmentName.Text = resCtrl.DepartmentName;
                    lblEmployeeName.Text = resCtrl.EmployeeName;
                    lblEmployeeID.Text = resCtrl.EmployeeId;
                    lblEmployeeEmailID.Text = resCtrl.EmployeeEmail;
                }

                if (!IsPostBack)
                {
                    if (resCtrl.AddToTable(Request.QueryString["itemCode"]) == SystemStoreInventorySystemUtil.Constants.ACTION_STATUS.FAIL)
                    {
                        // print error message
                    }
                    else
                    {
                        FillItemList();
                    }
                    lblRequisitionDate.Text = SystemStoreInventorySystemUtil.Converter.dateTimeToString(SystemStoreInventorySystemUtil.Converter.DATE_CONVERTER.DATETIME, DateTime.Now);
                    lblRequisitionID.Text = resCtrl.RequisitionId;
                    lblDepartmentCode.Text = resCtrl.DepartmentCode;
                    lblDepartmentName.Text = resCtrl.DepartmentName;
                    lblEmployeeName.Text = resCtrl.EmployeeName;
                    lblEmployeeID.Text = resCtrl.EmployeeId;
                    lblEmployeeEmailID.Text = resCtrl.EmployeeEmail;

                    FillItems();
                }

            }
            else
            {
                if (!IsPostBack)
                {
                    resCtrl = GetControl();

                    StationeryStoreInventorySystemController.Util.PutSession(sessionKey, resCtrl);

                    lblRequisitionDate.Text = SystemStoreInventorySystemUtil.Converter.dateTimeToString(SystemStoreInventorySystemUtil.Converter.DATE_CONVERTER.DATETIME, DateTime.Now);
                    lblRequisitionID.Text = resCtrl.RequisitionId;
                    lblDepartmentCode.Text = resCtrl.DepartmentCode;
                    lblDepartmentName.Text = resCtrl.DepartmentName;
                    lblEmployeeName.Text = resCtrl.EmployeeName;
                    lblEmployeeID.Text = resCtrl.EmployeeId;
                    lblEmployeeEmailID.Text = resCtrl.EmployeeEmail;

                    FillItems();
                }
                else
                {
                    resCtrl = (RequestStationeryControl)StationeryStoreInventorySystemController.Util.GetSession(sessionKey);
                }
            }
        }