Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DDL_Unit.DataSource = Utility.Unitlist.UnitList();
         DDL_Unit.DataBind();
         LoadContent();
         Session["PriceID"] = null;
     }
     SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     if (Session["PriceID"] != null)
     {
         string PriceIDArray = Session["PriceID"].ToString();
         // var vals = valueStr.Split(',')[0];
         PriceID           = PriceIDArray.Split('ξ')[0];
         Session["thisID"] = PriceID;
         ItermName         = PriceIDArray.Split('ξ')[1];
         LoadContent();
     }
     if ((DDLKind.SelectedValue == "workitem"))
     {
         BtnRLink.Enabled = true;
     }
     else
     {
         BtnRLink.Enabled = false;
     }
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
     {
         Response.Redirect("Login.aspx");
     }
     else if (Session["ProjectCode"] == null || Session["ProjectCode"] == "")
     {
         Response.Write("<script>alert('尚未選擇專案或是您的權限不足');location.href='Main.aspx';</script>");
     }
     else
     {
         //SqlDataSource3.SelectCommand = "SELECT PriceID, PriceName, Complex, AnaNumber, Price, Unit, Code, PccCode, ReferenceID, ReferenceNumber FROM PriceAnalysis";
         if (Session["ProjectCode"] != null)
         {
             SqlDataSource4.SelectCommand = Sql1;
         }
         SqlDataSource3.SelectCommand = Sql;
     }
     SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     SqlDataSource2.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     SqlDataSource3.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     SqlDataSource4.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     if (!IsPostBack)
     {
         SqlDataSource3.SelectCommand = Sql;
         GridView2.DataBind();
         DDL_Unit.DataSource = Utility.Unitlist.UnitList();
         DDL_Unit.DataBind();
         DDL_EdUnit.DataSource = Utility.Unitlist.UnitList();
         DDL_EdUnit.DataBind();
     }
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["ID"]       = Request.QueryString["ID"];
            DDL_Unit.DataSource = Utility.Unitlist.UnitList();

            if (!IsPostBack)
            {
                make_table_loading(Session["DatabaseName"].ToString(), Session["ID"].ToString());
                //ViewState["edit_count"] = 0;
            }
            else
            {
                if (Session["PriceName"] == null)
                {
                    Session["PriceName"] = "0";
                }
                if (Session["PriceNumber"] == null)
                {
                    Session["PriceNumber"] = "0";
                }
                //else
                //{
                make_table(Session["DatabaseName"].ToString(), Session["ID"].ToString(), Session["PriceName"].ToString(), Session["PriceNumber"].ToString());
                //}
            }
            DDL_Unit.DataBind();
            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource1.SelectCommand    = "Select * from PrivateResource";
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource1.SelectCommand    = "Select * from EBudget_WBS where Pid=" + Session["ProjectCode"].ToString() + " and EEdition<>0";
            SqlDataSource4.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (!IsPostBack)
            {
                ViewState["i"]   = 0;
                ViewState["ADD"] = null;
                //Session["layer"] = 0;
                //Session["PriceID"] = null;
                //Session["ItemName"] = null;
                //Session["Notes"] = null;
                //Session["Quantity"] = null;
                LoadContent();
                DDL_Unit.DataSource = Utility.Unitlist.UnitList();
                DDL_Unit.DataBind();
            }
            if (Session["PriceID"] != null)
            {
                string PriceIDArray = Session["PriceID"].ToString();
                // var vals = valueStr.Split(',')[0];
                PriceID           = PriceIDArray.Split('ξ')[0];
                Session["thisID"] = PriceID;
                ItemName          = PriceIDArray.Split('ξ')[1];
                LoadContent();
            }


            //TxItemName.Attributes.Add("value", TxItemName.Text);
            if (Session["ItemName"] != null)
            {
                TxItemName.Text = Session["ItemName"].ToString();
            }
            if (Session["Quantity"] != null)
            {
                TxQuantity.Text = Session["Quantity"].ToString();
            }
            if (Session["stock"] != null)
            {
                TxNotes.Text = Session["Notes"].ToString();
            }

            //ViewState["ItemName"] = TxItemName.Text;
            //ViewState["Notes"] = TxNotes.Text;
        }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
     {
         Response.Redirect("Login.aspx");
     }
     if (!IsPostBack)
     {
         DDL_Unit.DataSource = Utility.Unitlist.UnitList();
         DDL_Unit.DataBind();
         LoadContent();
         Session["PriceID"] = null;
     }
     SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     if (Session["PriceID"] != null)
     {
         string PriceIDArray = Session["PriceID"].ToString();
         // var vals = valueStr.Split(',')[0];
         PriceID           = PriceIDArray.Split(',')[0];
         Session["thisID"] = PriceID;
         ItermName         = PriceIDArray.Split(',')[1];
         LoadContent();
     }
 }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            if (Session["bid"] == null || Session["bid"] == "")
            {
                Response.Write("<script>alert('尚未選擇專案');location.href='Main.aspx';</script>");
            }
            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (!IsPostBack)
            {
                DDL_Unit.DataSource = Utility.Unitlist.UnitList();
                DDL_Unit.DataBind();


                LoadContent();
                Session["DDLLayer"]            = null;
                Session["DDLDtUpper"]          = null;
                Session["DDLNext"]             = null;
                Session["DDLKind"]             = null;
                Session["TxItemName"]          = null;
                Session["DDL_Unit"]            = null;
                Session["PriceID"]             = null;
                Session["ResourceLinkPriceID"] = null;
                ListItem LI2 = new ListItem();
                LI2.Text  = "-請選擇-";
                LI2.Value = "0";
                DDL_Unit.Items.Insert(0, LI2);
                if (UID != "")
                {
                    string    database   = Session["DatabaseName"].ToString();
                    string    SQLString1 = "Select * from Bid_WBS where UId=" + UID;
                    DataTable DataTable  = WebModel.LoadSetContentData(database, SQLString1);
                    foreach (DataRow row in DataTable.Rows)
                    {
                        //DDLLayer.DataBind();
                        //DDLLayer.AutoPostBack = true;
                        DDLLayer.SelectedValue = row["LayerNum"].ToString().Trim();
                        DDLLayer_SelectedIndexChanged(this, null);
                        DDLDtUpper.AutoPostBack = true;
                        DDLDtUpper.DataSourceID = "SqlDataSource1";
                        DDLDtUpper.DataBind();
                        DDLDtUpper.SelectedValue = row["UpperUID"].ToString();
                        DDLTop_SelectedIndexChanged(this, null);
                        DDLNext.DataBind();
                        DDLNext.SelectedValue = row["SortNum"].ToString();
                        DDLKind.SelectedValue = row["ItemKind"].ToString();
                        TxItemName.Text       = row["ItemName"].ToString();
                        DDL_Unit.DataBind();
                        DDL_Unit.SelectedValue = row["Unit"].ToString();
                        string PriceID = row["PriceID"].ToString();
                        if (PriceID != "")
                        {
                            string SQLSelectString = "Select * from Bid_Library where PriceID=" + PriceID;
                            ItemName.Text = WebModel.SItemName(database, SQLSelectString, "ItemName");
                        }
                        if (row["ItemKind"].ToString() == "workitem")
                        {
                            Button17.Enabled = true;
                        }
                        else
                        {
                            Button17.Enabled = false;
                        }
                    }
                }
            }


            //if (Session["PriceID"] != null && Session["PriceID"] != "")
            //{

            //    string PriceIDArray = Session["PriceID"].ToString();

            //    PriceID = PriceIDArray.Split('ξ')[0];
            //    Session["thisID"] = PriceID;
            //    ItemName.Text = PriceIDArray.Split('ξ')[1];
            //    DDLLayer.SelectedValue = Session["DDLLayer"].ToString();
            //    DDLDtUpper.SelectedValue = Session["DDLDtUpper"].ToString();
            //    DDLNext.SelectedValue = Session["DDLNext"].ToString();
            //    DDLKind.SelectedValue = Session["DDLKind"].ToString();
            //    TxItemName.Text = Session["TxItemName"].ToString();
            //    DDL_Unit.SelectedValue = Session["DDL_Unit"].ToString();
            //    LbPriceID.Text = PriceID;
            //    LoadContent();
            //    Session["DDLLayer"] = null;
            //    Session["DDLDtUpper"] = null;
            //    Session["DDLNext"] = null;
            //    Session["DDLKind"] = null;
            //    Session["TxItemName"] = null;
            //    Session["DDL_Unit"] = null;
            //    Session["PriceID"] = null;
            //}
            if (Session["ResourceLinkPriceID"] != null && Session["ResourceLinkPriceID"] != "")
            {
                string PriceIDArray = Session["ResourceLinkPriceID"].ToString();
                string database     = Session["DatabaseName"].ToString();
                PriceID                  = PriceIDArray.Split('ξ')[0];
                Session["thisID"]        = PriceID;
                ItemName.Text            = PriceIDArray.Split('ξ')[1];
                DDLLayer.SelectedValue   = Session["DDLLayer"].ToString();
                DDLDtUpper.SelectedValue = Session["DDLDtUpper"].ToString();
                DDLNext.SelectedValue    = Session["DDLNext"].ToString();
                DDLKind.SelectedValue    = Session["DDLKind"].ToString();
                TxItemName.Text          = Session["TxItemName"].ToString();
                DDL_Unit.SelectedValue   = Session["DDL_Unit"].ToString();
                LbPriceID.Text           = PriceID;
                LoadContent();

                string    SQLString1    = "Select  *  from  Bid_Library  where PriceID=" + PriceID + "";
                DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQLString1);
                if (DataTableBox1 != null && DataTableBox1.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox1.Rows)
                    {
                        ItemName.Text = row["ItemName"].ToString();
                    }
                }
                Session["DDLLayer"]   = null;
                Session["DDLDtUpper"] = null;
                Session["DDLNext"]    = null;
                Session["DDLKind"]    = null;
                Session["TxItemName"] = null;
                Session["DDL_Unit"]   = null;
                Session["PriceID"]    = null;


                Session["ResourceLinkPriceID"] = null;
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            if (Session["bid"] == null || Session["bid"] == "")
            {
                Response.Write("<script>alert('尚未選擇標案');self.close();</script>");
            }
            if (!IsPostBack)
            {
                DDL_Unit.DataSource = Utility.Unitlist.UnitList();
                DDL_Unit.DataBind();
                ListItem LI2 = new ListItem();
                LI2.Text  = "-請選擇-";
                LI2.Value = "0";
                DDL_Unit.Items.Insert(0, LI2);
                Button17.Enabled = false;
                LoadContent();
                Session["DDLLayer"]            = null;
                Session["DDLDtUpper"]          = null;
                Session["DDLNext"]             = null;
                Session["DDLKind"]             = null;
                Session["TxItemName"]          = null;
                Session["DDL_Unit"]            = null;
                Session["PriceID"]             = null;
                Session["ResourceLinkPriceID"] = null;
                ItemName.Text = "";
            }

            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (Session["ResourceLinkPriceID"] != null && Session["ResourceLinkPriceID"] != "")
            {
                string PriceIDArray = Session["ResourceLinkPriceID"].ToString();

                PriceID           = PriceIDArray.Split('ξ')[0];
                Session["thisID"] = PriceID;
                ItemName.Text     = PriceIDArray.Split('ξ')[1];
                if (Session["DDLLayer"] != null && Session["DDLLayer"].ToString() != "")
                {
                    DDLLayer.SelectedValue = Session["DDLLayer"].ToString();
                }
                if (Session["DDLDtUpper"] != null && Session["DDLDtUpper"] != "")
                {
                    DDLDtUpper.SelectedValue = Session["DDLDtUpper"].ToString();
                }
                if (Session["DDLNext"] != null)
                {
                    DDLNext.SelectedValue = Session["DDLNext"].ToString();
                }
                if (Session["DDLKind"] != null && Session["DDLKind"] != "")
                {
                    DDLKind.SelectedValue = Session["DDLKind"].ToString();
                }
                if (Session["TxItemName"] != null && Session["TxItemName"] != "")
                {
                    TxItemName.Text = Session["TxItemName"].ToString();
                }
                if (Session["DDL_Unit"] != null && Session["DDL_Unit"] != "")
                {
                    DDL_Unit.SelectedValue = Session["DDL_Unit"].ToString();
                }

                LoadContent();
                Session["DDLLayer"]   = null;
                Session["DDLDtUpper"] = null;
                Session["DDLNext"]    = null;
                Session["DDLKind"]    = null;
                Session["TxItemName"] = null;
                Session["DDL_Unit"]   = null;
                Session["PriceID"]    = null;
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            if (DropDownList3.SelectedValue != "0" && DropDownList3.SelectedValue != "")
            {
                //showid.Style.Add("style", "display:block;");
                showid.Visible = true;
            }
            else
            {
                showid.Visible = false;
            }
            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource2.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource3.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (!IsPostBack)
            {
                DDL_EdUnit.DataSource = Utility.Unitlist.UnitList();
                DDL_Unit.DataSource   = Utility.Unitlist.UnitList();
                DDL_EdUnit.DataBind();
                DDL_Unit.DataBind();
                //SqlDataSource2.SelectCommand = "select * from Bid_Library where bid=" + Session["Bid"].ToString() + "";
                if (Session["Bid"] != null)
                {
                    SqlDataSource2.SelectCommand = Sql;
                }
                DropDownList3_SelectedIndexChanged(this, null);
            }


            //SqlDataSource3.SelectCommand = "SELECT PriceID, PriceName, Complex, AnaNumber, Price, Unit, Code, PccCode, ReferenceID, ReferenceNumber FROM PriceAnalysis ";
            #region 搜尋條件
            string SelectString = "";
            string ItemName     = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxWBS.Text));
            SelectString = (DDL_WBS.SelectedValue != "0") ? "Code like '%" + DDL_WBS.SelectedValue + "%'" : "";
            if (DDL_WBS.SelectedValue != "0" && ItemName == "")
            {
                SelectString += "";
            }
            else if (DDL_WBS.SelectedValue != "0" && ItemName != "")
            {
                SelectString += DDL_Op2.SelectedValue + " ItemName like '%" + ItemName + "%'";
            }
            else if (DDL_WBS.SelectedValue == "0" && ItemName != "")
            {
                SelectString += (ItemName != "") ? " ItemName like '%" + ItemName + "%'" : "";
            }

            SelectString = (SelectString.Length > 1) ? "where " + SelectString + "" : "";

            SqlDataSource3.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource3.SelectCommand    = "SELECT PriceID, ItemName, Complex, AnaNumber, Price, Unit, Code,ItemKind FROM [PrivateResource] ";
            SqlDataSource3.SelectCommand   += SelectString + " ORDER BY PriceID ASC ";
            #endregion

            //DropDownList DDL = (DropDownList)Master.FindControl("Ddl_Project");
            //DDL.Visible = false;
            if (Session["Bid"] != null)
            {
                if (Sql != "")
                {
                    SqlDataSource2.SelectCommand = Sql;
                }
                else
                {
                    SqlDataSource2.SelectCommand = "select * from Bid_Library where bid=" + Session["Bid"].ToString() + "";
                }
            }
        }