Example #1
0
        protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager  editMan    = editedItem.EditManager;

            string label = null;
            Int32  class_typ;
            Int32  tr_type;

            label = (editedItem["trolley_label"].Controls[0] as TextBox).Text;

            RadComboBox classtype   = (RadComboBox)editedItem.FindControl("trolleyclass_type_RadComboBox");
            RadComboBox trolleytype = (RadComboBox)editedItem.FindControl("trolleytype_RadComboBox");

            class_typ = Int32.Parse(classtype.SelectedValue);
            if (class_typ == 3)//multi trolley
            {
                tr_type = Int32.Parse(trolleytype.SelectedValue);
            }
            else

            {
                tr_type = 0;
            }
            string displayname = User.Identity.Name;

            TrolleyDAO tmgrins         = new TrolleyDAO();
            decimal    trolleyreturnid = tmgrins.Create_trolley(class_typ, tr_type, label, displayname);

            //RadGrid1.DataSource = dataSet.Tables[0];
            BindData();
        }
Example #2
0
        public void BindData()
        {
            TrolleyDAO tmgr    = new TrolleyDAO();
            DataSet    dataSet = tmgr.Search_trolley();

            RadGrid1.DataSource = dataSet.Tables[0];
        }
Example #3
0
        protected void trolleyclass_type_RadComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadComboBox      combobox = (RadComboBox)sender;
            GridEditFormItem edititem = (GridEditFormItem)combobox.NamingContainer;


            if (combobox.SelectedValue == "3")
            {
                // trolley type drop down
                TrolleyDAO trolleydao   = new TrolleyDAO();
                DataSet    trolleyCodes = new DataSet();
                trolleyCodes = trolleydao.GetCodesByType();
                RadComboBox trolleytype = (RadComboBox)edititem
                                          .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;

                RequiredFieldValidator RequiredFieldValidator2 = (RequiredFieldValidator)edititem
                                                                 .FindControl("RequiredFieldValidator2");

                RequiredFieldValidator2.Enabled = true;
            }
            else
            {
                RadComboBox trolleytype = (RadComboBox)edititem
                                          .FindControl("trolleytype_RadComboBox");

                trolleytype.Visible = false;
            }
        }
Example #4
0
        public void BindData_tritem(Int32 I_trolley_id)
        {
            TrolleyDAO trov    = new TrolleyDAO();
            DataSet    ds_trov = new DataSet();

            ds_trov             = trov.Get_trolley_items(I_trolley_id);
            RadGrid2.DataSource = ds_trov.Tables[0];
        }
Example #5
0
        public void BindData_troverview(string I_trlabel, Int32 I_trstatus, Int32 I_trclass, string I_sergrp)
        {
            TrolleyDAO trov    = new TrolleyDAO();
            DataSet    ds_trov = new DataSet();

            ds_trov             = trov.Get_trolley_overview(I_trlabel, I_trstatus, I_trclass, I_sergrp);
            RadGrid2.DataSource = ds_trov.Tables[0];
        }
Example #6
0
        private void Getdropdown(string Input)
        {
            TrolleyDAO trdao = new TrolleyDAO();
            DataSet    ds_cd = new DataSet();
            DataTable  dt_cd = new DataTable();



            switch (Input)
            {
            case "Class":
                ds_cd = trdao.Get_tr_class();
                dt_cd = ds_cd.Tables[0];

                foreach (DataRow row in dt_cd.Rows)
                {
                    string item_code_str = row["code"].ToString();
                    string item_desc     = row["codedesc"].ToString();
                    DD_class.Items.Insert(0, new ListItem(item_desc, item_code_str));
                }
                break;

            case "Status":
                ds_cd = trdao.Get_tr_status();
                dt_cd = ds_cd.Tables[0];

                foreach (DataRow row in dt_cd.Rows)
                {
                    string item_code_str = row["code"].ToString();
                    string item_desc     = row["codedesc"].ToString();
                    DD_status.Items.Insert(0, new ListItem(item_desc, item_code_str));
                }
                break;

            case "Service":
                ds_cd = trdao.Get_service_group();
                dt_cd = ds_cd.Tables[0];

                foreach (DataRow row in dt_cd.Rows)
                {
                    string item_code_str = row["code"].ToString();
                    string item_desc     = row["codedesc"].ToString();
                    DD_sergrp.Items.Insert(0, new ListItem(item_desc, item_code_str));
                }
                break;
            }
        }
Example #7
0
        protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager  editMan    = editedItem.EditManager;

            string ID = editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["trolley_id"].ToString();
            Int32  tr_type;
            string label = null;

            label = (editedItem["trolley_label"].Controls[0] as TextBox).Text;

            Int32 itrolleyid = Int32.Parse(ID);

            TrolleyDAO tmgr    = new TrolleyDAO();
            DataSet    ds_edit = tmgr.Get_trolleyclass(itrolleyid);

            DataTable dt_edit = new DataTable();

            dt_edit = ds_edit.Tables[0];

            Int32 class_typ = 0;

            foreach (DataRow row in dt_edit.Rows)
            {
                string class_typ_str = row["class_id"].ToString();
                class_typ = Int32.Parse(class_typ_str);
            }
            RadComboBox trolleytype = (RadComboBox)editedItem.FindControl("trolleytype_RadComboBox");


            tr_type = 0;

            string displayname = User.Identity.Name;

            TrolleyDAO tmgrupd    = new TrolleyDAO();
            decimal    trolley_id = tmgrupd.Update_trolley(itrolleyid, label, tr_type, displayname);

            //RadGrid1.DataSource = dataSet.Tables[0];
            BindData();
        }
Example #8
0
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
            {
                DataSet          ds_codes   = new DataSet();
                GridEditableItem editedItem = e.Item as GridEditableItem;


                //testing
                GridEditFormInsertItem insert = e.Item as GridEditFormInsertItem;
                if (insert == null) // for edit hide classtype
                {
                    //in editedItem mode hide both dropdowns
                    // disable the validation
                    RadComboBox trolleytype = (RadComboBox)editedItem
                                              .FindControl("trolleytype_RadComboBox");
                    trolleytype.Visible = false;

                    RadComboBox trolleyclassType = (RadComboBox)editedItem
                                                   .FindControl("trolleyclass_type_RadComboBox");

                    trolleyclassType.Visible = false;


                    RequiredFieldValidator RequiredFieldValidator1 = (RequiredFieldValidator)editedItem
                                                                     .FindControl("RequiredFieldValidator1");

                    RequiredFieldValidator1.Enabled = false;

                    RequiredFieldValidator RequiredFieldValidator2 = (RequiredFieldValidator)editedItem
                                                                     .FindControl("RequiredFieldValidator2");

                    RequiredFieldValidator2.Enabled = false;
                }
                else
                {
                    TrolleyDAO trolleydao = new TrolleyDAO();
                    ds_codes = trolleydao.GetClassCodes();
                    RadComboBox trolleyclassType = (RadComboBox)editedItem
                                                   .FindControl("trolleyclass_type_RadComboBox");
                    trolleyclassType.DataSource = ds_codes.Tables["CD"];

                    trolleyclassType.DataTextField  = "char_short_translation";
                    trolleyclassType.DataValueField = "code";
                    trolleyclassType.DataBind();

                    trolleyclassType.Items.Insert(0, new RadComboBoxItem("", "0"));



                    // trolley type drop down


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

                    RequiredFieldValidator RequiredFieldValidator2 = (RequiredFieldValidator)editedItem
                                                                     .FindControl("RequiredFieldValidator2");

                    RequiredFieldValidator2.Enabled = false;
                }
            }
        }
Example #9
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;
                }
            }
        }
Example #10
0
        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;

                String strolleyid = dataItem.GetDataKeyValue("trolley_id").ToString();
                Int32  itrolleyid = Int32.Parse(strolleyid);

                DataSet    ds_wrkst   = new DataSet();
                TrolleyDAO trolleydao = new TrolleyDAO();

                ds_wrkst = trolleydao.Get_trolley_wrk(itrolleyid);



                if (ds_wrkst.Tables[0].Rows.Count > 0)
                {
                    RadComboBox wrkst = (RadComboBox)e.Item.FindControl("wrkst_RadComboBox");
                    wrkst.Visible    = true;
                    wrkst.DataSource = ds_wrkst.Tables[0];

                    wrkst.DataTextField  = "label";
                    wrkst.DataValueField = "wrkid";
                    wrkst.DataBind();



                    //trolleyclassType.Items.Insert(0, new RadComboBoxItem("", "0"));
                }


                else
                {
                    RadComboBox wrkst = (RadComboBox)e.Item.FindControl("wrkst_RadComboBox");
                    wrkst.Visible = false;
                }


                // for the image

                TableCell cell          = dataItem["percent_located"];
                Image     completeImage = (Image)cell.FindControl("completeimage");
                Label     locatedText   = (Label)cell.FindControl("itemslocated");

                string located = ((DataRowView)e.Item.DataItem).Row["percent_located"].ToString();
                Int32  change  = -1;

                if (located != null && located != string.Empty)
                {
                    change = Int32.Parse(located);
                }
                if (change == 100)
                {
                    completeImage.ImageUrl = "~/Images/green.gif";
                    //changeText.Style["color"] = "green";
                }
                else if (change >= 60)
                {
                    completeImage.ImageUrl = "~/Images/yellow.gif";
                    //changeText.Style["color"] = "red";
                }
                else if (change < 60 && change >= 0)
                {
                    completeImage.ImageUrl = "~/Images/red.gif";
                }
                else
                {
                    completeImage.Visible = false;
                }
            }
        }