コード例 #1
0
        public void BindData()
        {
            ChuteDAO chutedao = new ChuteDAO();
            DataSet  dataSet  = chutedao.Search_chute();

            RadGrid1.DataSource = dataSet.Tables[0];
        }
コード例 #2
0
        public void BindData(Int32 area_ID)
        {
            ChuteDAO chmgr   = new ChuteDAO();
            DataSet  dataSet = chmgr.Chutes_In_Area(area_ID);

            RadGrid1.DataSource = dataSet.Tables[0];

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                rowcount++;
            }
        }
コード例 #3
0
        protected void Btn_stack_Click(object sender, System.EventArgs e)
        {
            ChuteDAO       chmgr    = new ChuteDAO();
            UserActivity   setclass = new UserActivity();
            ActivityLogDAO actlog   = new ActivityLogDAO();

            Int32  stack_seq   = 0;
            string displayname = User.Identity.Name;

            try
            {
                stack_seq = Int32.Parse(tb_stack.Text.ToString());

                if (stack_seq != 0)
                {
                    decimal upd_status = chmgr.Manage_stack(areaID, stack_seq, displayname);

                    if (upd_status == 0)
                    {
                        HandleError("Stacks and Trolleys Created successfully", 0);
                    }
                    else if (upd_status == -1)
                    {
                        HandleError("Trolley detach Failed", 1);
                    }
                    else
                    {
                        HandleError("Error Occurred", 1);
                    }
                }
                else
                {
                    HandleError("Invalid Stack Sequence", 1);
                }
                Initialize_stack();
            }
            catch (Exception ex2)
            {
                HandleError(ex2.Message, 1);
                Initialize_save();
            }

            BindData(areaID);
            RadGrid1.Rebind();
        }
コード例 #4
0
        void Initialize_save()
        {
            Btn_chute.Enabled = false;

            Btn_stack.Visible = true;
            lbl_stack.Visible = true;
            tb_stack.Visible  = true;
            RequiredFieldValidator1.Visible = true;
            tb_stack.Text = string.Empty;

            ChuteDAO chutedao = new ChuteDAO();

            if (chutedao.CheckStack(areaID.ToString()))
            {
                Btn_stack.Enabled = false;
            }
            else
            {
                Btn_stack.Enabled = true;
            }
        }
コード例 #5
0
        protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;


            string  ch_label = null;
            Int32   ch_status_int;
            Int32   ch_type_int;
            string  enb_ind_str;
            string  int_ind_str;
            decimal area_id_dec;
            string  displayname = User.Identity.Name;
            Int32   trolley_type_int;

            decimal Chuteid = decimal.Parse(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["chute_id"].ToString());

            RadTextBox chlabel = (RadTextBox)editedItem.FindControl("ch_label_TextBox");

            ch_label = chlabel.Text.ToString();

            //RadComboBox chstatus = (RadComboBox)editedItem.FindControl("ch_status_RadComboBox");
            RadComboBox chtype = (RadComboBox)editedItem.FindControl("ch_type_RadComboBox");
            RadComboBox enbind = (RadComboBox)editedItem.FindControl("ch_enb_ind_RadComboBox");
            //RadComboBox intind = (RadComboBox)editedItem.FindControl("ch_int_ind_RadComboBox");
            RadComboBox areaid      = (RadComboBox)editedItem.FindControl("ch_area_RadComboBox");
            RadComboBox trolleytype = (RadComboBox)editedItem.FindControl("trolleytype_RadComboBox");

            //ch_status_int = Int32.Parse(chstatus.SelectedValue);
            ch_status_int = 3;
            ch_type_int   = Int32.Parse(chtype.SelectedValue);
            enb_ind_str   = enbind.SelectedValue.ToString();
            //int_ind_str = intind.SelectedValue.ToString();
            area_id_dec = decimal.Parse(areaid.SelectedValue);

            if (ch_type_int == 2)//multi chute
            {
                trolley_type_int = Int32.Parse(trolleytype.SelectedValue);
            }
            else
            {
                trolley_type_int = 0;
            }
            ChuteDAO chuteinsert = new ChuteDAO();

            try
            {
                decimal chuteid = chuteinsert.Update_Chute(Chuteid,
                                                           ch_label,
                                                           ch_status_int,
                                                           ch_type_int,
                                                           enb_ind_str,
                                                           area_id_dec,
                                                           displayname,
                                                           trolley_type_int);
                if (chuteid == 0)
                {
                    // display error
                    string err_msg = "Error while updating Chute ID: " + Chuteid;
                    HandleError(err_msg, 1);
                }
                else if (chuteid == -1)
                {
                    string err_msg = "Area in Use. Cannot update Chute";
                    HandleError(err_msg, 1);
                }
                else
                {
                    HandleError("Chute Updated", 0);
                }
            }
            catch (Exception ex_upd)
            {
                string err = ex_upd.Message;
                HandleError(err, 1);
            }
            BindData();
        }
コード例 #6
0
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;

                decimal Chuteid     = decimal.Parse(dataItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["chute_id"].ToString());
                Label   chtype      = (Label)dataItem.FindControl("chtypid");
                Int32   ch_type_int = Int32.Parse(chtype.Text);
                //

                // for the edit image

                if (Chuteid >= 10000 && ch_type_int == 2)
                {
                    dataItem["EditCommandColumn"].Controls[0].Visible = true;
                }
                else
                {
                    dataItem["EditCommandColumn"].Controls[0].Visible = false;
                }
            }
            if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
            {
                GridEditableItem       editedItem = e.Item as GridEditableItem;
                GridEditFormInsertItem insert     = e.Item as GridEditFormInsertItem;



                ChuteDAO chute_dao = new ChuteDAO();

                // chute type drop down

                DataSet ds_chutetype = new DataSet();
                ds_chutetype = chute_dao.GetChuteType();

                RadComboBox chtype = (RadComboBox)editedItem
                                     .FindControl("ch_type_RadComboBox");

                chtype.DataSource     = ds_chutetype.Tables["CT"];
                chtype.DataTextField  = "type_short_name";
                chtype.DataValueField = "chute_type_id";
                chtype.DataBind();
                chtype.Items.Insert(0, new RadComboBoxItem("", "0"));



                // chute status drop down

                /*
                 * DataSet ds_chstatus = new DataSet();
                 * ds_chstatus = chute_dao.GetChuteStatus();
                 *
                 * RadComboBox chstatus = (RadComboBox)editedItem
                 *                              .FindControl("ch_status_RadComboBox");
                 *
                 * chstatus.DataSource = ds_chstatus.Tables["CS"];
                 * chstatus.DataTextField = "status_short_name";
                 * chstatus.DataValueField = "chute_status_id";
                 * chstatus.DataBind();
                 * chstatus.Items.Insert(0, new RadComboBoxItem("", "0"));*/


                // Enable indicator drop down

                DataSet ds_enbind = new DataSet();
                ds_enbind = chute_dao.GetEnableInd();

                RadComboBox enbind = (RadComboBox)editedItem
                                     .FindControl("ch_enb_ind_RadComboBox");

                enbind.DataSource     = ds_enbind.Tables["EI"];
                enbind.DataTextField  = "ch_enable_desc";
                enbind.DataValueField = "ch_enable_code";
                enbind.DataBind();
                enbind.Items.Insert(0, new RadComboBoxItem("", "0"));


                // International indicator drop down

                //DataSet ds_intind = new DataSet();
                //ds_intind = chute_dao.GetIntInd();

                //RadComboBox intind = (RadComboBox)editedItem
                //                                .FindControl("ch_int_ind_RadComboBox");

                //intind.DataSource = ds_intind.Tables["II"];
                //intind.DataTextField = "ch_int_desc";
                //intind.DataValueField = "ch_int_code";
                //intind.DataBind();
                //intind.Items.Insert(0, new RadComboBoxItem("", "0"));



                // Area drop down

                DataSet ds_area = new DataSet();
                ds_area = chute_dao.GetArea();

                RadComboBox area = (RadComboBox)editedItem
                                   .FindControl("ch_area_RadComboBox");

                area.DataSource     = ds_area.Tables["AR"];
                area.DataTextField  = "area_desc";
                area.DataValueField = "aread_id";
                area.DataBind();
                area.Items.Insert(0, new RadComboBoxItem("", "0"));


                TrolleyDAO trolleydao   = new TrolleyDAO();
                DataSet    trolleyCodes = new DataSet();
                trolleyCodes = trolleydao.GetCodesByType();
                RadComboBox trolleytype = (RadComboBox)editedItem
                                          .FindControl("trolleytype_RadComboBox");

                trolleytype.DataSource     = trolleyCodes.Tables["TT"];
                trolleytype.DataTextField  = "type_short_name";
                trolleytype.DataValueField = "type_id";
                trolleytype.DataBind();
                trolleytype.Items.Insert(0, new RadComboBoxItem("", "0"));
                trolleytype.Visible = true;

                //RadComboBox trolleytype = (RadComboBox)editedItem
                //                                        .FindControl("trolleytype_RadComboBox");
                //trolleytype.Visible = false;

                //RequiredFieldValidator RequiredFieldValidator6 = (RequiredFieldValidator)editedItem
                //                                .FindControl("RequiredFieldValidator6");

                //RequiredFieldValidator6.Enabled = false;


                if (e.Item.ItemIndex != -1)
                {
                    Int32 ChuteID = Int32.Parse(
                        editedItem
                        .OwnerTableView
                        .DataKeyValues[e.Item.ItemIndex]["chute_id"]
                        .ToString());



                    DataSet ds_chutedtls = new DataSet();
                    ds_chutedtls = chute_dao.Get_chuteclass(ChuteID);

                    DataTable dt_chutedtls = ds_chutedtls.Tables[0];

                    Int32  ch_type       = 0;
                    Int32  tr_type       = 0;
                    Int32  area_id       = 0;
                    string label         = null;
                    string enable        = null;
                    string international = null;


                    foreach (DataRow row in dt_chutedtls.Rows)
                    {
                        ch_type       = Int32.Parse(row["chutetyp_id"].ToString());
                        tr_type       = Int32.Parse(row["trtyp_id"].ToString());
                        enable        = row["enb_ind"].ToString();
                        international = row["int_ind"].ToString();
                        area_id       = Int32.Parse(row["area_id"].ToString());
                        label         = row["chlabel"].ToString();
                    }

                    RadTextBox ch_label = (RadTextBox)editedItem.FindControl("ch_label_TextBox");
                    ch_label.Text = label;

                    chtype.SelectedValue      = ch_type.ToString();
                    trolleytype.SelectedValue = tr_type.ToString();
                    area.SelectedValue        = area_id.ToString();
                    //intind.SelectedValue = enable;
                    enbind.SelectedValue = international;
                }
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Initialize();

                string areaidstr = Request.QueryString["Area_id"].ToString();
                if (areaidstr != null)
                {
                    areaID = Int32.Parse(areaidstr);
                }



                ChuteDAO chmgr       = new ChuteDAO();
                string   area_status = chmgr.Check_area(areaID);

                //if (area_status == "T")
                //{
                //    RadGrid1.Enabled = false;
                //    Btn_chute.Enabled = false;

                //    lblArea.Text = " Area "+ areaID + " is in Use.";
                //    lblArea.ForeColor = Color.Blue;
                //}
                //else
                //{
                //    RadGrid1.Enabled = true;
                //    Btn_chute.Enabled = true;

                //    lblArea.Text = "Chutes for Area ID: " + areaID;
                //    lblArea.ForeColor = Color.Blue;

                //}

                this.BindData(areaID);

                if (rowcount > 0)
                {
                    if (area_status == "T")
                    {
                        RadGrid1.Enabled  = false;
                        Btn_chute.Enabled = false;

                        lblArea.Text      = " Area " + areaID + " is in Use.";
                        lblArea.ForeColor = Color.Blue;
                    }
                    else
                    {
                        RadGrid1.Enabled  = true;
                        Btn_chute.Enabled = true;

                        lblArea.Text      = "Chutes for Area ID: " + areaID;
                        lblArea.ForeColor = Color.Blue;
                    }
                }
                else
                {
                    Btn_chute.Enabled = false;

                    lblArea.Text      = "No Chutes exist for Area ID: " + areaID;
                    lblArea.ForeColor = Color.Blue;
                }
            }
            catch (Exception ex1)
            {
                HandleError(ex1.Message, 1);
            }
        }
コード例 #8
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            ChuteDAO       chmgr    = new ChuteDAO();
            UserActivity   setclass = new UserActivity();
            ActivityLogDAO actlog   = new ActivityLogDAO();

            string displayname = User.Identity.Name;

            // Create new DataTable and DataSource objects.
            DataTable dt_seq = new DataTable();

            // Declare DataColumn and DataRow variables.
            DataColumn dc_seq;
            DataRow    dr_seq;


            // Create new DataColumn, set DataType, ColumnName and add to DataTable.
            dc_seq            = new DataColumn();
            dc_seq.DataType   = System.Type.GetType("System.Int32");
            dc_seq.ColumnName = "chute_id";
            dt_seq.Columns.Add(dc_seq);

            // Create second column.
            dc_seq            = new DataColumn();
            dc_seq.DataType   = System.Type.GetType("System.Int32");
            dc_seq.ColumnName = "chute_seq";
            dt_seq.Columns.Add(dc_seq);

            try
            {
                foreach (GridItem item in RadGrid1.MasterTableView.Items)
                {
                    if (item is GridEditableItem)
                    {
                        GridEditableItem editableItem = item as GridDataItem;
                        string           chuteid_str  = editableItem.OwnerTableView.DataKeyValues[item.ItemIndex]["chute_id"].ToString();
                        Int32            chuteid      = Int32.Parse(chuteid_str);

                        Label ch_typ_lab = (Label)editableItem.FindControl("ch_type_lab");
                        Int32 ch_type_id = Int32.Parse(ch_typ_lab.Text);

                        if (ch_type_id == 2)
                        {
                            RadTextBox ch_seq_tb = (RadTextBox)editableItem.FindControl("ch_seq_TextBox");
                            Int32      ch_seq_id = Int32.Parse(ch_seq_tb.Text);

                            // Create new DataRow objects and add to DataTable.

                            dr_seq              = dt_seq.NewRow();
                            dr_seq["chute_id"]  = chuteid;
                            dr_seq["chute_seq"] = ch_seq_id;
                            dt_seq.Rows.Add(dr_seq);
                        }
                    }
                }

                dt_seq.DefaultView.Sort = "chute_seq";
                dt_seq = dt_seq.DefaultView.ToTable();

                Int32 realseq = 1;


                foreach (DataRow row in dt_seq.Rows)
                {
                    string id_str = row["chute_id"].ToString();
                    Int32  id     = Int32.Parse(id_str);

                    decimal Chute_id = chmgr.Update_Chute_seq(id, realseq, displayname);

                    realseq++;
                }

                HandleError("Updated Chute Sequence Successfully", 0);

                Initialize_save();
            }
            catch (Exception ex)
            {
                // activity logging
                HandleError(ex.Message, 1);
            }

            BindData(areaID);
            RadGrid1.Rebind();
        }