//Method used when one of the events on the page is updating the table and query
 private void ItemBinding(DataView view)
 {
     //Sets the datasource of the webpage's Gridview to the TableBase object's returned Dataview from event methods.
     GridViewItem.DataSource = view;
     //Calls for the page to be updated and a postback
     GridViewItem.DataBind();
 }
        private void bindItem()
        {
            string sql = "select * from TBQM_APLYFORITEM where CONTID='" + hfditem.Value + "'";

            System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sql);
            GridViewItem.DataSource = dt;
            GridViewItem.DataBind();
        }
        private void LoadProductionProccess()
        {
            string OrderNo = txtOrder.Text;

            var result = masterBLL.GetProductionStatus(OrderNo);

            if (result.Count > 0)
            {
                GridViewItem.DataSource = result;
                GridViewItem.DataBind();
            }
        }
예제 #4
0
        void BindItem()
        {
            try
            {
                var dept = objItem_BLL.GetFoodItem().ToList();
                if (dept.Count > 0)
                {
                    GridViewItem.DataSource = dept.ToList();
                    GridViewItem.DataBind();
                }
                else
                {
                    var obj = new List <LU_Tbl_Item>();
                    obj.Add(new LU_Tbl_Item());

                    // Bind the DataTable which contain a blank row to the GridView
                    GridViewItem.DataSource = obj;
                    GridViewItem.DataBind();

                    int columnsCount = GridViewItem.Columns.Count;
                    GridViewItem.Rows[0].Cells.Clear();                           // clear all the cells in the row
                    GridViewItem.Rows[0].Cells.Add(new TableCell());              //add a new blank cell
                    GridViewItem.Rows[0].Cells[0].ColumnSpan      = columnsCount; //set the column span to the new added cell
                    GridViewItem.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
                    GridViewItem.Rows[0].Cells[0].ForeColor       = System.Drawing.Color.Red;
                    GridViewItem.Rows[0].Cells[0].Font.Bold       = true;

                    //set No Results found to the new added cell
                    GridViewItem.Rows[0].Cells[0].Text = "NO RECORDS FOUND!";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["userInfo"];

        if (Request.Cookies["userInfo"] == null)
        {
            Response.Redirect("login.aspx");
        }
        else
        {
            nameLabel.Text = Request.Cookies["userInfo"]["firstName"];
            if (Request.Cookies["userInfo"]["admin"] == "True")  //Checks to see if the user is an admin or not and enables related department and employee items to be shown
            {
                addEmployeeModal.Visible   = true;
                addDepartmentModal.Visible = true;
                departmentnav.Visible      = true;
                employeenav.Visible        = true;
                blockopenemployees.Visible = true;
                opendepartmodal.Visible    = true;
                openemployeemodal.Visible  = true;
            }
            cookie.Expires = DateTime.Now.AddMinutes(10);
            Response.Cookies.Set(cookie);
        }


        if (!Page.IsPostBack)
        {
            DropDownPop();
            //Creates default TableBase object based on target view/table and Default sorting column
            Base = new TableBase("RecentPurchaseOrders", "DateOrdered");
            //Binds the default data to ViewState in order to keep throughout postbacks
            ViewState["Table"] = Base;
            //Initial binding and loading of data onto table
            this.Binding();

            //Creates default TableBase object based on target view/table and Default sorting column
            BaseItem = new TableBase("AddItem", "SKU");

            //Binds the default data to ViewState in order to keep throughout postbacks
            ViewState["ItemTable"] = BaseItem;

            //New Mepty datatable is created to store data of temporary purchase order
            dt = new DataTable();
            //Columns are added to new datatable with appropriate names
            dt.Columns.AddRange(new DataColumn[5] {
                new DataColumn("SKU", typeof(string)), new DataColumn("ItemName", typeof(string)), new DataColumn("SupplierID", typeof(string)), new DataColumn("Quantity", typeof(int)), new DataColumn("Price", typeof(decimal))
            });


            ViewState["ordertable"] = dt;

            //Initial binding and loading of data onto table
            GridViewItem.DataSource = BaseItem.BindGrid();
            GridViewItem.DataBind();
            OrderBinding();

            ModalIDPop();
        }
        else //All consecutive refreshes/postbacks will update the ViewState key with new recurring data.
        {
            Base = (TableBase)ViewState["Table"];

            BaseItem = (TableBase)ViewState["ItemTable"];
            //BaseOrder = (TableBase)ViewState["OrderTable"];
            dt = ViewState["ordertable"] as DataTable;
            OrderBinding();

            if (GridViewItem.SelectedRow != null) //Checks to see if there are any selected rows during a postback
            {
                AddItemButton.Enabled = true;
            }
            else
            {
                AddItemButton.Enabled = false;
            }
        }
        TotalPrice();
    }
        private void BindYingOrKuiItem(string strsql, int state)
        {
            DataTable dt = DBCallCommon.GetDTUsingSqlText(strsql);

            GridViewItem.DataSource = dt;
            GridViewItem.DataBind();
            System.Collections.Generic.List <string> ltsql = new System.Collections.Generic.List <string>();
            if (state == 0)
            {
                //盘盈
                if (dt.Rows.Count == 0)
                {
                    //第一次
                    if (!IsPostBack)
                    {
                        //状态未更改

                        if (LabelYState.Text == "0")
                        {
                            string sqlstr = "update TBWS_INVENTORYSCHEMA set PD_YSTATE='2' where PD_CODE='" + LabelCode.Text.Trim() + "'";
                            ltsql.Add(sqlstr);

                            sqlstr = "update TBWS_INVENTORYSCHEMA set PD_DONESTATE='3' where PD_YSTATE='1' and PD_KSTATE='1' and PD_CODE='" + LabelCode.Text.Trim() + "'";
                            ltsql.Add(sqlstr);

                            DBCallCommon.ExecuteTrans(ltsql);
                        }
                    }

                    btnIn.Visible     = false;
                    btnInView.Visible = false;

                    btnOut.Visible     = false;
                    btnOutView.Visible = false;

                    ImageYState.Visible = false;
                    ImageKState.Visible = false;
                }
                else
                {
                    if (LabelYState.Text != "0")
                    {
                        btnIn.Visible     = false;
                        btnInView.Visible = true;

                        btnOut.Visible     = false;
                        btnOutView.Visible = false;

                        if (LabelState.Text != "3")
                        {
                            //盘盈图片显示
                            if (LabelYState.Text == "2")
                            {
                                ImageYState.Visible = true;
                                ImageKState.Visible = false;
                            }
                        }
                    }
                }
            }
            else
            {
                //盘亏
                if (dt.Rows.Count == 0)
                {
                    if (LabelKState.Text == "0")
                    {
                        string sqlstr = "update TBWS_INVENTORYSCHEMA set PD_KSTATE='2' where PD_CODE='" + LabelCode.Text.Trim() + "'";
                        ltsql.Add(sqlstr);

                        sqlstr = "update TBWS_INVENTORYSCHEMA set PD_DONESTATE='3' where PD_YSTATE='2' and PD_KSTATE='2' and PD_CODE='" + LabelCode.Text.Trim() + "'";
                        ltsql.Add(sqlstr);

                        DBCallCommon.ExecuteTrans(ltsql);
                    }


                    btnIn.Visible     = false;
                    btnInView.Visible = false;

                    btnOut.Visible     = false;
                    btnOutView.Visible = false;

                    ImageKState.Visible = false;
                    ImageYState.Visible = false;
                }
                else
                {
                    if (LabelKState.Text != "0")
                    {
                        //
                        btnIn.Visible     = false;
                        btnInView.Visible = false;

                        btnOut.Visible     = false;
                        btnOutView.Visible = true;

                        if (LabelState.Text != "3")
                        {
                            if (LabelKState.Text == "2")
                            {
                                //盘亏图片显示
                                ImageKState.Visible = true;
                                ImageYState.Visible = false;
                            }
                        }
                    }
                }
            }
        }
예제 #7
0
        /*    protected void DisplayItemCatQRPriCode(object sender, EventArgs e)
         *  {
         *       OracleConnection conn = new OracleConnection(strConnString);
         *       conn.Open();
         *
         *       int USER_DATA_ID = Convert.ToInt32(DropDownItemExpID.Text);
         *
         *
         *       DataTable dtUserTypeID = new DataTable();
         *       DataSet ds = new DataSet();
         *       string makeSQL = " select AIC.ITEM_CAT_QR_PRI_CODE  from IT_ASSET_ITEM_EXPIRES AIE left join IT_ASSET_ITEM_CATEGORIES AIC ON AIC.ITEM_CATEGORY_ID = AIE.ITEM_CATEGORY_ID  where AIE.ITEM_EXP_ID = '" + USER_DATA_ID + "'";
         *
         *       cmdl = new OracleCommand(makeSQL);
         *       oradata = new OracleDataAdapter(cmdl.CommandText, conn);
         *       dt = new DataTable();
         *       oradata.Fill(dt);
         *       RowCount = dt.Rows.Count;
         *
         *       for (int i = 0; i < RowCount; i++)
         *       {
         *           TextQRPreCode.Text = dt.Rows[i]["ITEM_CAT_QR_PRI_CODE"].ToString();
         *       }
         *
         *       conn.Close();
         *  //     Display();
         *       CheckQRCode.Text = "";
         *       alert_box.Visible = false;
         *       BtnAdd.Attributes.Add("aria-disabled", "false");
         *       BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
         *
         *       if (EmpStatus == 0)
         *       {
         *        //   PlaceHolder1.Text = "if";
         *       }
         *       else
         *       {
         *         //  PlaceHolder1.Text = "else";
         *           GridViewItem.UseAccessibleHeader = true;
         *           GridViewItem.HeaderRow.TableSection = TableRowSection.TableHeader;
         *
         *
         *       }
         *
         *
         *
         *  } */


        public void DisplayEmpItem(object sender, EventArgs e)
        {
            OracleConnection conn = new OracleConnection(strConnString);

            conn.Open();
            DataTable dtItemID = new DataTable();
            DataSet   di = new DataSet();
            string    USER_DATA_ID0 = ""; int USER_DATA_ID = 0, USER_DATA_ID2 = 0, USER_DATA_ID3 = 0, USER_DATA_ID4 = 0; string makeSQL = "";

            if (radExpSelect.SelectedValue == "Employee")
            {
                USER_DATA_ID0 = DropDownEmployeeID.SelectedValue;
                makeSQL       = " select AEIE.*, AIE.ITEM_EXP_NAME, (EXTRACT (DAY FROM (AEIE.EXPIRES_DATE-SYSDATE)))  AS EXPIRED_DAYS_BET,  AEIE.EXPIRED_DAYS , AEIE.IS_ACTIVE from IT_ASSET_EMP_ITEM_EXPIRES AEIE left join IT_ASSET_ITEM_EXPIRES AIE ON AIE.ITEM_EXP_ID = AEIE.ITEM_EXP_ID where AEIE.EMP_ID = '" + USER_DATA_ID0 + "' order by AEIE.EMP_ITEM_EXP_ID";


                string makeItemSQL = " SELECT IAEI.EMP_ITEMS_ID, AI.ITEM_NAME || ' - ' || AI.ITEM_TYPE || ' ' || AI.ITEM_BRAND AS ITEM_NAME_ALL from IT_ASSET_EMP_ITEMS IAEI  LEFT JOIN  IT_ASSET_ITEMS AI ON AI.ITEM_ID = IAEI.ITEM_ID  LEFT JOIN IT_ASSET_ITEM_CATEGORIES AIC ON AIC.ITEM_CATEGORY_ID = AI.ITEM_CATEGORY_ID WHERE IAEI.EMP_ID = '" + USER_DATA_ID0 + "' AND AI.IS_ACTIVE = 'Enable' AND (AIC.ITEM_CAT_QR_PRI_CODE = 'CPU' OR AIC.ITEM_CAT_QR_PRI_CODE = 'ITD') ORDER BY AI.ITEM_ID ASC";
                di       = ExecuteBySqlString(makeItemSQL);
                dtItemID = (DataTable)di.Tables[0];
                DropDownItemID.DataSource     = dtItemID;
                DropDownItemID.DataValueField = "EMP_ITEMS_ID";
                DropDownItemID.DataTextField  = "ITEM_NAME_ALL";
                DropDownItemID.DataBind();
                DropDownItemID.Items.Insert(0, new ListItem("Select  Item", "0"));

                cmdl    = new OracleCommand(makeSQL);
                oradata = new OracleDataAdapter(cmdl.CommandText, conn);
                dt      = new DataTable();
                oradata.Fill(dt);
                GridViewItem.DataSource   = dt;
                GridViewItem.DataKeyNames = new string[] { "EMP_ITEM_EXP_ID" };
                GridViewItem.DataBind();



                for (int i = 0; GridViewItemDept.Columns.Count > i;)
                {
                    GridViewItemDept.Columns.RemoveAt(i);
                }
            }
            else
            {
                USER_DATA_ID  = Convert.ToInt32(DropDownDepartmentID.SelectedValue);
                USER_DATA_ID2 = Convert.ToInt32(DropDownDivisionID.SelectedValue);
                USER_DATA_ID3 = Convert.ToInt32(DropDownLocationID.SelectedValue);
                USER_DATA_ID4 = Convert.ToInt32(DropDownPlacementID.SelectedValue);
                makeSQL       = " select AEIE.*, AIE.ITEM_EXP_NAME, (EXTRACT (DAY FROM (AEIE.EXPIRES_DATE-SYSDATE)))  AS EXPIRED_DAYS_BET,  AEIE.EXPIRED_DAYS , AEIE.IS_ACTIVE, IAIP.PLACEMENT_NAME from IT_ASSET_EMP_ITEM_EXPIRES AEIE left join IT_ASSET_ITEM_EXPIRES AIE ON AIE.ITEM_EXP_ID = AEIE.ITEM_EXP_ID left join IT_ASSET_ITEMS_PLACEMENT IAIP ON IAIP.PLACEMENT_ID = AEIE.PLACEMENT_ID  where AEIE.DEPARTMENT_ID = '" + USER_DATA_ID + "' AND AEIE.DIVISION_ID = '" + USER_DATA_ID2 + "' AND AEIE.LOCATION_ID = '" + USER_DATA_ID3 + "' AND AEIE.PLACEMENT_ID = '" + USER_DATA_ID4 + "' order by AEIE.EMP_ITEM_EXP_ID";

                string makeItemSQL = " SELECT IAEI.EMP_ITEMS_ID, AI.ITEM_NAME || ' - ' || AI.ITEM_TYPE || ' ' || AI.ITEM_BRAND AS ITEM_NAME_ALL from IT_ASSET_EMP_ITEMS IAEI  LEFT JOIN  IT_ASSET_ITEMS AI ON AI.ITEM_ID = IAEI.ITEM_ID  LEFT JOIN IT_ASSET_ITEM_CATEGORIES AIC ON AIC.ITEM_CATEGORY_ID = AI.ITEM_CATEGORY_ID WHERE IAEI.DEPARTMENT_ID = '" + USER_DATA_ID + "' AND IAEI.DIVISION_ID = '" + USER_DATA_ID2 + "' AND IAEI.LOCATION_ID = '" + USER_DATA_ID3 + "'  AND IAEI.PLACEMENT_ID = '" + USER_DATA_ID4 + "'  AND AI.IS_ACTIVE = 'Enable' AND (AIC.ITEM_CAT_QR_PRI_CODE = 'CPU' OR AIC.ITEM_CAT_QR_PRI_CODE = 'ITD') ORDER BY AI.ITEM_ID ASC";
                di       = ExecuteBySqlString(makeItemSQL);
                dtItemID = (DataTable)di.Tables[0];
                DropDownItemID.DataSource     = dtItemID;
                DropDownItemID.DataValueField = "EMP_ITEMS_ID";
                DropDownItemID.DataTextField  = "ITEM_NAME_ALL";
                DropDownItemID.DataBind();
                DropDownItemID.Items.Insert(0, new ListItem("Select  Item", "0"));

                cmdl    = new OracleCommand(makeSQL);
                oradata = new OracleDataAdapter(cmdl.CommandText, conn);
                ds      = new DataTable();
                oradata.Fill(ds);
                GridViewItemDept.DataSource   = ds;
                GridViewItemDept.DataKeyNames = new string[] { "EMP_ITEM_EXP_ID" };
                GridViewItemDept.DataBind();


                for (int i = 0; GridViewItem.Columns.Count > i;)
                {
                    GridViewItem.Columns.RemoveAt(i);
                }
            }

            DropDownItemID.Attributes.Remove("disabled");
            BtnAdd.Attributes.Add("aria-disabled", "true");
            BtnAdd.Attributes.Add("class", "btn btn-primary active");

            TextItemID.Text          = "";
            DropDownItemID.Text      = "0";
            DropDownItemExpID.Text   = "0";
            TextSerialNo.Text        = "";
            TextActivationCode.Text  = "";
            TextExpiredDays.Text     = "";
            TextStartExpiryDate.Text = "";
            conn.Close();
            alert_box.Visible = false;
        }
예제 #8
0
        public void BtnAdd_Click(object sender, EventArgs e)
        {
            //   try
            //   {
            if (IS_ADD_ACTIVE == "Enable")
            {
                OracleConnection conn = new OracleConnection(strConnString);
                conn.Open();

                int userID = Convert.ToInt32(Session["USER_ID"]);
                //   string TextQRCodeAll = TextQRPreCode.Text + '-' + TextQRCode.Text;
                int    ItemID    = Convert.ToInt32(DropDownItemID.Text);
                int    ItemExpID = Convert.ToInt32(DropDownItemExpID.Text);
                string u_date    = System.DateTime.Now.ToString("dd-MM-yyyy h:mm:ss tt");
                string ISActive  = CheckIsActive.Checked ? "Enable" : "Disable";

                string   StartExpiryDate      = TextStartExpiryDate.Text;
                string[] StartExpiryDateSplit = StartExpiryDate.Split('-');

                String   StartDateTemp  = StartExpiryDateSplit[0].Replace("/", "-");
                String   StartDateTemp1 = StartDateTemp.Replace("M ", "M");
                DateTime StartDate      = DateTime.ParseExact(StartDateTemp1, "dd-MM-yyyy h:mm:ss tt", CultureInfo.InvariantCulture);

                String   ExpiryDateTemp  = StartExpiryDateSplit[1].Replace("/", "-");
                String   ExpiryDateTemp1 = ExpiryDateTemp.Trim();
                DateTime ExpiryDate      = DateTime.ParseExact(ExpiryDateTemp1, "dd-MM-yyyy h:mm:ss tt", CultureInfo.InvariantCulture);

                string get_user_id = "select IT_ASSET_EMP_ITEM_EXPSID_SEQ.nextval from dual";
                cmdi = new OracleCommand(get_user_id, conn);
                int newExpID = Int16.Parse(cmdi.ExecuteScalar().ToString());

                if (radExpSelect.SelectedValue == "Employee")
                {
                    string EmployeeID  = DropDownEmployeeID.Text;
                    string insert_user = "******";
                    cmdi = new OracleCommand(insert_user, conn);

                    OracleParameter[] objPrm = new OracleParameter[12];
                    objPrm[0]  = cmdi.Parameters.Add("TextEmpItemsExpID", newExpID);
                    objPrm[1]  = cmdi.Parameters.Add("NoEmployeeID", EmployeeID);
                    objPrm[2]  = cmdi.Parameters.Add("NoItemExpID", ItemExpID);
                    objPrm[3]  = cmdi.Parameters.Add("NoItemID", ItemID);
                    objPrm[4]  = cmdi.Parameters.Add("TextSerialNo", TextSerialNo.Text);
                    objPrm[5]  = cmdi.Parameters.Add("TextActivationCode", TextActivationCode.Text);
                    objPrm[6]  = cmdi.Parameters.Add("TextStartDate", StartDate);
                    objPrm[7]  = cmdi.Parameters.Add("TextExpiryDate", ExpiryDate);
                    objPrm[8]  = cmdi.Parameters.Add("TextExpiryDays", TextExpiredDays.Text);
                    objPrm[9]  = cmdi.Parameters.Add("u_date", u_date);
                    objPrm[10] = cmdi.Parameters.Add("NoC_USER_ID", userID);
                    objPrm[11] = cmdi.Parameters.Add("TextIsActive", ISActive);
                }
                else
                {
                    int DepartmentID = Convert.ToInt32(DropDownDepartmentID.Text);
                    int DivisionID   = Convert.ToInt32(DropDownDivisionID.Text);
                    int LocationID   = Convert.ToInt32(DropDownLocationID.Text);
                    int PlacementID  = Convert.ToInt32(DropDownPlacementID.Text);

                    string insert_user = "******";
                    cmdi = new OracleCommand(insert_user, conn);

                    OracleParameter[] objPrm = new OracleParameter[15];
                    objPrm[0]  = cmdi.Parameters.Add("TextEmpItemsExpID", newExpID);
                    objPrm[1]  = cmdi.Parameters.Add("NoDepartmentID", DepartmentID);
                    objPrm[2]  = cmdi.Parameters.Add("NoDivisionID", DivisionID);
                    objPrm[3]  = cmdi.Parameters.Add("NoLocationID", LocationID);
                    objPrm[4]  = cmdi.Parameters.Add("NoPlacementID", PlacementID);
                    objPrm[5]  = cmdi.Parameters.Add("NoItemExpID", ItemExpID);
                    objPrm[6]  = cmdi.Parameters.Add("NoItemID", ItemID);
                    objPrm[7]  = cmdi.Parameters.Add("TextSerialNo", TextSerialNo.Text);
                    objPrm[8]  = cmdi.Parameters.Add("TextActivationCode", TextActivationCode.Text);
                    objPrm[9]  = cmdi.Parameters.Add("TextStartDate", StartDate);
                    objPrm[10] = cmdi.Parameters.Add("TextExpiryDate", ExpiryDate);
                    objPrm[11] = cmdi.Parameters.Add("TextExpiryDays", TextExpiredDays.Text);
                    objPrm[12] = cmdi.Parameters.Add("u_date", u_date);
                    objPrm[13] = cmdi.Parameters.Add("NoC_USER_ID", userID);
                    objPrm[14] = cmdi.Parameters.Add("TextIsActive", ISActive);
                }

                cmdi.ExecuteNonQuery();

                cmdi.Parameters.Clear();
                cmdi.Dispose();
                conn.Close();
                alert_box.Visible = true;
                alert_box.Controls.Add(new LiteralControl("Insert New Expire Item successfully"));
                alert_box.Attributes.Add("class", "alert alert-success alert-dismissible");
                clearText();
                //  Display();
                GridViewItem.DataBind();
            }
            else
            {
                Response.Redirect("~/PagePermissionError.aspx");
            }
            //     }
            //     catch
            //     {
            //         Response.Redirect("~/ParameterError.aspx");
            //     }
        }