예제 #1
0
        //取得建入資料
        protected DataTable GetDataBox()
        {
            string    database     = Session["DatabaseName"].ToString();
            DataTable DataTableBox = new DataTable();

            string SQLString = "PID,LayerNum,UpperWID,SortNum,PriceID,ItemName,Unit,ItemKind,Notes,EEdition";

            string SQLUpdateSort;

            foreach (string DataName in SQLString.Split(','))
            {
                DataTableBox.Columns.Add(DataName, typeof(string));
            }


            //後台功能,必需要有的欄位名稱

            DataRow DataTableDr = DataTableBox.NewRow();


            string TopWBS   = DDLTop.SelectedValue;
            string Next     = DDLNext.SelectedValue;
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxItemName.Text));
            string Notes    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxNotes.Text));

            //int Number = 0;

            //bool output = int.TryParse(TxQuantity.Text, out Number);
            #region 內容設定
            if (Session["ProjectCode"] != null)
            {
                DataTableDr["Pid"]      = Session["ProjectCode"].ToString();
                DataTableDr["LayerNum"] = DDLLayer.SelectedValue;
                DataTableDr["UpperWID"] = DDLTop.SelectedValue;
                DataTableDr["SortNum"]  = DDLNext.SelectedValue;
                DataTableDr["Unit"]     = DDL_Unit.SelectedValue;
                DataTableDr["ItemName"] = ItemName;
                //DataTableDr["LastCNumber"] = Number;
                DataTableDr["ItemKind"] = DDL_ItemKind.SelectedValue;
                if (Session["thisID"] != null)
                {
                    DataTableDr["PriceId"] = Session["thisID"].ToString() != ""?Session["thisID"].ToString():"0";
                }
                DataTableDr["Notes"]    = Notes;
                DataTableDr["EEdition"] = int.Parse(LbEdition.Text);

                //SortNum = int.Parse(DDLNext.SelectedValue);
                DataTableBox.Rows.Add(DataTableDr);
                #endregion


                SQLUpdateSort = "update EBudget_WBS set sortnum=SortNum+1 where LayerNum=" + DDLLayer.SelectedValue + " and UpperWID=" + DDLTop.SelectedValue + " and SortNum >=" + DDLNext.SelectedValue + "";
                WebModel.SQLAction(database, SQLUpdateSort);
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true);
            }
            return(DataTableBox);
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null || (Session["ProjectCode"] == null)))
            {
                Response.Redirect("Main.aspx");
            }
            if (!IsPostBack)
            {
                SqlDataSource1.SelectCommand = Sql;
                LoadContent();
            }


            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (SystemSet.GetRequestSet("PriceID") != "")
            {
                SqlDataSource1.SelectCommand = "select * from  Pro_Resource where  PID=" + Session["ProjectCode"].ToString() + " AND PriceID not in (select KidID from Pro_Analysis where ParentID=" + PriceID + ") and PriceID<>" + PriceID + "";
                Sql = SqlDataSource1.SelectCommand;
            }
            else
            {
                //SqlDataSource1.SelectCommand = "Select  *  from Bid_AnaRelation a left join Bid_Library b on a.KidID=b.PriceID left join Bid_WBS c on b.PriceID=c.PriceID where a.ParentID=" + PriceID + " and b.BID=" + Session["bid"].ToString() + " order by A.SortNum";
                //SqlDataSource1.SelectCommand = "Select  *  from Bid_AnaRelation a left join Bid_Library b on a.KidID=b.PriceID left join Bid_WBS c on b.PriceID=c.PriceID where  b.BID=" + Session["bid"].ToString() + "and b.ItemKind='拆工拆料項' or b.ItemKind='連工帶料項' order by A.SortNum";
                SqlDataSource1.SelectCommand = "select * from  Pro_Resource where  PID=" + Session["ProjectCode"].ToString() + "";
            }
            string database = Session["DatabaseName"].ToString();
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            //SqlDataSource sql = new SqlDataSource();
            SqlDataSource1.SelectCommand = Sql;
        }
예제 #3
0
        protected void EdConfirm_Click(object sender, EventArgs e)
        {
            string database     = Session["DatabaseName"].ToString();
            string EditItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(EdItemName.Text));
            string EditCode     = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(EdCode.Text));
            string EditNotes    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(EdNotes.Text));
            string Sql          = "update " + _TableName + " set BID=" + Session["bid"] + ", ";
            string SQRstring    = "";

            SQRstring += (EditItemName != "") ? " ItemName='" + EditItemName + "' ,": "'";
            SQRstring += (DDL_EdUnit.SelectedValue != "") ? " Unit='" + DDL_EdUnit.SelectedValue + "'" : "";
            SQRstring += (EditCode != "") ? ",Code='" + EditCode + "'": "";
            SQRstring += (EditNotes != "") ? ",Notes='" + EditNotes + "'" : "";
            SQRstring += (DDL_edit.SelectedValue != "0") ? ",ItemKind='" + DDL_edit.SelectedItem.Text + "'" : "";

            string Sql1   = (SQRstring.Length > 1) ?Sql + SQRstring + " where PriceID= '" + Session["PriceID"].ToString() + "'" : "";
            bool   result = WebModel.SQLAction(database, Sql1);

            EdItemName.Text        = "";
            EdCode.Text            = "";
            EdNotes.Text           = "";
            DDL_edit.SelectedValue = "0";
            if (result)
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('已修改完成');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔失敗');", true);
            }
            GridView1.DataBind();
        }
예제 #4
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            if (Session["Bid"] != null)
            {
                string database = Session["DatabaseName"].ToString();
                string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxPro.Text));

                #region 搜尋條件
                string SelectString = "";

                SelectString = (DDL_Select2.SelectedValue != "0") ? "Type like '%" + DDL_Select2.SelectedValue + "%' " : "";

                SelectString += (ItemName != "") ? "" + DDL_Op2.SelectedValue + " SupportItem like '%" + ItemName + "%' " : "";

                SelectString = (SelectString.Length > 1) ?  SelectString : "";
                #endregion
                SqlDataSource6.SelectCommand  = (SelectString.Length > 1) ? SqlDataSource6.SelectCommand.Substring(0, SqlDataSource6.SelectCommand.Length) : SqlDataSource6.SelectCommand;
                SqlDataSource6.SelectCommand += " where " + SelectString + "";
                GridView4.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請選擇標案');", true);
            }
        }
예제 #5
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string KeyWord = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSubBudget.Text));

            #region 搜尋條件
            string SelectString = "";

            SelectString = (KeyWord != "") ? "SC_Name like '%" + KeyWord + "%' " : "";
            //if (TxDate1.Text != "")
            //{
            if (KeyWord != "" && DDL_Firm.SelectedValue != "0")
            {
                SelectString += DDL_Op1.SelectedValue;
            }
            if (DDL_Firm.SelectedValue != "0")
            {
                SelectString += " FirmID=" + DDL_Firm.SelectedValue;
            }

            SelectString = (SelectString.Length > 1) ? SelectString : "";
            //SqlDataSource1.SelectCommand = "SELECT SBID, PID, SB_Code, SB_Name, BookInTime, BookContractDate, LastContractDate, ContractWay, WorkManDep, WorkManName, BudgetPrice, BudgetLockNY, SC_Code FROM SubBudgetList  ";
            SqlDataSource1.SelectCommand += (SelectString.Length > 1) ? " and " + SelectString + " and SubContract_Main.pid=" + Session["ProjectCode"].ToString() : "";


            #endregion

            GridView1.DataBind();
        }
예제 #6
0
        protected void BidSearch_Click(object sender, EventArgs e)
        {
            if (Session["Bid"] != null)
            {
                string database = Session["DatabaseName"].ToString();
                string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxBidWBS.Text));

                #region 搜尋條件
                string SelectString = "";

                SelectString = (DDL_WBS1.SelectedValue != "0") ? " and Code like '%" + DDL_WBS1.SelectedValue + "%' " : "";

                SelectString += (ItemName != "") ? "" + DDL_Op3.SelectedValue + " ItemName like '%" + ItemName + "%' " : "";

                SelectString = (SelectString.Length > 1) ?  SelectString : "";
                SqlDataSource2.SelectCommand  = "select * from Bid_Library where bid=" + Session["Bid"].ToString() + "";
                SqlDataSource2.SelectCommand  = (SelectString.Length > 1) ? SqlDataSource2.SelectCommand.Substring(0, SqlDataSource2.SelectCommand.Length) : SqlDataSource2.SelectCommand;
                SqlDataSource2.SelectCommand += "" + SelectString + " ORDER BY PriceID DESC";
                Sql = SqlDataSource2.SelectCommand;
                ViewState["Sql"] = Sql;
                #endregion

                GridView1.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請選擇標案');", true);
            }
        }
예제 #7
0
        protected void Add_Click(object sender, EventArgs e)
        {
            string database  = Session["DatabaseName"].ToString();
            string datatable = "Pro_Resource";

            ErrorString += (DDLKind.SelectedValue) == "0" ? "請輸入工項類型!!\\n" : "";
            ErrorString += (TxItemName.Text) == string.Empty ? "請輸入名稱!!\\n" : "";
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxItemName.Text));
            bool   select   = datacheck(ItemName, DDL_Unit.SelectedValue);

            if (select == true)
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 已有相同工料名稱');", true);
            }
            else
            {
                //確認是否全選
                if (ErrorString == "")
                {
                    WebModel.SaveAction(database, datatable, GetDataBox());

                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode();", true);//ajax 新增階層碼
                }
                else
                {
                    ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true);
                }
                TxItemName.Text       = "";
                DDLKind.SelectedValue = "0";
                TxNotes.Text          = "";
            }
        }
예제 #8
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            //ViewState["all"] = false;
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            //Session["FdSearch"] = FdSearch;
            Sql = "";
            string SelectString = "";

            if (PriceID == "")
            {
                PriceID = "0";
            }
            SqlDataSource1.SelectCommand = "select * from  Pro_Resource where  PID=" + Session["ProjectCode"].ToString() + " AND PriceID not in (select KidID from Pro_Analysis where ParentID=" + PriceID + ") and PriceID<>" + PriceID + "";
            Sql = SqlDataSource1.SelectCommand;

            //SqlDataSource1.SelectCommand = "select * from  Pro_Resource where  PID=" + Session["ProjectCode"].ToString() + " AND PriceID not in (select KidID from Pro_Analysis where ParentID=" + PriceID + ") and PriceID<>" + PriceID + "";
            SelectString  = (DDL_Res.SelectedValue == "1") ? "Complex = " + DDL_Res.SelectedValue + " " : "Complex != 1 ";
            SelectString += (FdSearch != "") ? "" + DDL_Op2.SelectedValue + " ItemName like '%" + FdSearch + "%' " : "";
            SelectString  = (SelectString.Length > 1) ? " and " + SelectString + " " : "";

            Sql += SelectString;
            SqlDataSource1.SelectCommand = Sql;
            GridView1.DataBind();
        }
예제 #9
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string KeyWord = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxKeyWord.Text));

            #region 搜尋條件
            string SelectString = "";

            SelectString = (KeyWord != "") ? "SB_Name like '%" + KeyWord + "%' " : "";
            if (KeyWord != "" && DDL_Op3.SelectedValue != "")
            {
                SelectString += DDL_Op1.SelectedValue + " ";
            }
            SelectString += (DDL_Op3.SelectedValue != "") ? " BudgetLockNY = " + DDL_Op3.SelectedValue + "" : "";

            SelectString = (SelectString.Length > 1) ? SelectString : "";
            SqlDataSource1.SelectCommand  = "";
            SqlDataSource1.SelectCommand  = "SELECT SBID, PID, SB_Code, SB_Name, BookInTime, BookContractDate, LastContractDate, ContractWay, WorkManDep, WorkManName, BudgetPrice, BudgetLockNY, SC_Code FROM SubBudgetList  ";
            SqlDataSource1.SelectCommand  = (SelectString.Length > 1) ? SqlDataSource1.SelectCommand.Substring(0, SqlDataSource1.SelectCommand.Length) : SqlDataSource1.SelectCommand;
            SqlDataSource1.SelectCommand += (SelectString.Length > 1) ? "WHERE " + SelectString + " and PID = " + Session["ProjectCode"].ToString() + "" : " WHERE PID = " + Session["ProjectCode"].ToString() + "";


            #endregion

            GridView1.DataBind();
        }
예제 #10
0
        protected void Search_Click(object sender, EventArgs e)
        {
            string database = Session["DatabaseName"].ToString();
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));


            #region 搜尋條件
            string SelectString = "";
            SelectString = (ItemName != "") ? "ItemName like '%" + ItemName + "%' " + DDL_Op1.SelectedValue + "" : "";

            if (ItemName == "")
            {
                if (DDL_Op1.SelectedValue == "and")
                {
                    SelectString += "";
                }
                else if (DDL_Op1.SelectedValue == "or")
                {
                    SelectString += "";
                }
                else if (DDL_Op1.SelectedValue == "and NOT")
                {
                    SelectString += "not";
                }
            }

            SelectString += (DropDownList5.SelectedItem.Value != "0") ? " ResponseDept = '" + DropDownList5.SelectedValue + "'" : "";
            SelectString  = (SelectString.Length > 1) ? "where " + SelectString : "";
            #endregion

            SqlDataSource2.SelectCommand += SelectString;
            GridView1.DataBind();
        }
예제 #11
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string KeyWord = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSrSubName.Text));

            #region 搜尋條件
            string SelectString = "";

            //SelectString = (DDL_Sub.SelectedValue != "") ? "SC_Name like '%" + KeyWord + "%' " : "";
            SelectString = (KeyWord != "") ? "" + DDL_Sub.SelectedValue + " like '%" + KeyWord + "%' " : "";

            if (KeyWord != "" && DDL_Firm.SelectedValue != "0")
            {
                SelectString += DDL_Op1.SelectedValue;
            }
            if (DDL_Firm.SelectedValue != "0")
            {
                SelectString += " FirmID=" + DDL_Firm.SelectedValue;
            }

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

            SqlDataSource1.SelectCommand += (SelectString.Length > 1) ? " and " + SelectString + " and a.pid=" + Session["ProjectCode"].ToString() : "";


            #endregion

            GridView1.DataBind();
        }
예제 #12
0
        protected void Search_Click(object sender, ImageClickEventArgs e)
        {
            string Keyword = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBSearch.Text));

            Sql = "SELECT [PriceID],[ItemName],REPLACE(Unit,' ','') as Unit,[Complex],[AnaNumber],[Code],[Price],[Notes],REPLACE(ItemKind,' ','') as ItemKind FROM [PrivateResource] WHERE ItemName like '%" + Keyword + "%' ";
            SqlDataSource2.SelectCommand = Sql;
            GridView1.DataBind();
        }
예제 #13
0
        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            string database = Session["DatabaseName"].ToString();
            //string _TableName = "Bid_Library";
            string AnaNumber = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxAnaNumber.Text));
            string Sql       = "update " + _TableName + " set AnaNumber=" + AnaNumber + " where PriceID= '" + Session["PriceID"].ToString() + "'";

            WebModel.SQLAction(database, Sql);
            ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('已修改完成');", true);
        }
예제 #14
0
        protected void UpLoad_Click(object sender, EventArgs e)
        {
            string database    = Session["DatabaseName"].ToString();
            String savepath    = DAL.SystemSet.savePath(Session["DatabaseName"].ToString());
            string ProjectCode = Session["ProjectCode"].ToString();
            string RFQ_Code    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxNo.Text));

            if (FileUpload1.HasFile)
            {
                String fileName = FileUpload1.FileName;

                fileName = DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + "_" + fileName;
                string Name = AttachName.Text;
                savepath += fileName;
                string kind = DDL_kind.SelectedItem.Text;
                FileUpload1.SaveAs(savepath);
                // FileUpload1.SaveAs(System.Web.HttpContext.Current.Server.MapPath(savepath)); //上傳檔案


                string[] name     = fileName.Split('_');
                string   realname = name[1];

                Response.Write("<script>alert('" + kind + "" + realname + "已上傳');</script>");
                string    SQLInsert    = "RFQ_Code,Name,Type,Path";
                DataTable DataTableBox = new DataTable();
                foreach (string DataName in SQLInsert.Split(','))
                {
                    DataTableBox.Columns.Add(DataName, typeof(string));
                }

                DataRow DataTableDr = DataTableBox.NewRow();


                DataTableDr["RFQ_Code"] = RFQ_Code;
                DataTableDr["Name"]     = Name;
                DataTableDr["Type"]     = kind;
                DataTableDr["Path"]     = savepath;

                DataTableBox.Rows.Add(DataTableDr);

                string insert = WebModel.SaveAction(database, "RFQ_File", DataTableBox);
                GridView5.DataBind();
                if (insert != "1")
                {
                    Response.Write("<script>alert('" + kind + "" + realname + "已上傳,資料庫更新失敗');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('圖說" + FileUpload1.FileName + "上傳失敗');</script>");
            }
        }
예제 #15
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string KeyWord = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSubBudget.Text));

            #region 搜尋條件
            string SelectString = "";

            SelectString = (KeyWord != "") ? "SB_Name like '%" + KeyWord + "%' " : "";
            if (TxDate1.Text != "")
            {
                if (KeyWord != "" && TxDate1.Text != "")
                {
                    SelectString += DDL_Op1.SelectedValue;
                }
                if (DDL_date.SelectedValue == "BookInTime" && DDL_Op3.SelectedValue != "Between")
                {
                    SelectString += " BookInTime " + DDL_Op3.SelectedValue + " '" + DateTime.Parse(TxDate1.Text).ToString("yyyy-MM-dd") + "'";
                }
                else if (DDL_date.SelectedValue == "BookInTime" && DDL_Op3.SelectedValue == "Between")
                {
                    SelectString += " BookInTime " + DDL_Op3.SelectedValue + "'" + DateTime.Parse(TxDate1.Text).ToString("yyyy-MM-dd") + "' and " + "'" + DateTime.Parse(TxDate2.Text).ToString("yyyy-MM-dd") + "'";
                }
                if (DDL_date.SelectedValue == "BookContractDate" && DDL_Op3.SelectedValue != "Between")
                {
                    SelectString += " BookContractDate " + DDL_Op3.SelectedValue + "'" + DateTime.Parse(TxDate1.Text).ToString("yyyy-MM-dd") + "'";
                }
                else if (DDL_date.SelectedValue == "BookContractDate" && DDL_Op3.SelectedValue == "Between")
                {
                    SelectString += " BookContractDate " + DDL_Op3.SelectedValue + "'" + DateTime.Parse(TxDate1.Text).ToString("yyyy-MM-dd") + "' and " + "'" + DateTime.Parse(TxDate2.Text).ToString("yyyy-MM-dd") + "'";
                }
                if (DDL_date.SelectedValue == "LastContractDate" && DDL_Op3.SelectedValue != "Between")
                {
                    SelectString += " LastContractDate " + DDL_Op3.SelectedValue + "'" + DateTime.Parse(TxDate1.Text).ToString("yyyy-MM-dd") + "'";
                }
                else if (DDL_date.SelectedValue == "LastContractDate" && DDL_Op3.SelectedValue == "Between")
                {
                    SelectString += " LastContractDate " + DDL_Op3.SelectedValue + "'" + DateTime.Parse(TxDate1.Text).ToString("yyyy-MM-dd") + "' and " + "'" + DateTime.Parse(TxDate2.Text).ToString("yyyy-MM-dd") + "'";
                }
            }
            else
            {
                SelectString += "";
            }
            SelectString          = (SelectString.Length > 1) ? SelectString : "";
            Sql_SB.SelectCommand  = "SELECT SBID, PID, SB_Code, SB_Name, BookInTime, BookContractDate, LastContractDate, ContractWay, WorkManDep, WorkManName, BudgetPrice, BudgetLockNY, SC_Code FROM SubBudgetList  ";
            Sql_SB.SelectCommand += (SelectString.Length > 1) ? "WHERE " + SelectString + " and PID = " + Session["ProjectCode"].ToString() + "" : " WHERE PID = " + Session["ProjectCode"].ToString() + "";


            #endregion

            GV_SB.DataBind();
        }
예제 #16
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string database = Session["DatabaseName"].ToString();
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            SqlDataSource2.SelectCommand = "";
            Sql = "SELECT * FROM [Bid_Library] where bid=" + Session["Bid"].ToString();
            if (Session["bid"] != null)
            {
                string SelectString = "";
                //SelectString = (DDL_WBS.SelectedValue != "0") ? "Code like '%" + DDL_WBS.SelectedValue + "%' " + DDL_Op2.SelectedValue + "" : "";
                SelectString = (DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") ? "ItemKind like '%" + DDL_WBS.SelectedItem.Text + "%'" : "";
                if ((DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") && FdSearch == "")
                {
                    SelectString += "";
                }
                else if ((DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") && FdSearch != "")
                {
                    SelectString += DDL_Op2.SelectedValue + " ItemName like '%" + FdSearch + "%'";
                }
                else if ((DDL_WBS.SelectedItem.Text == "" || DDL_WBS.SelectedItem.Text == "-請選擇-") && FdSearch != "" && DDL_Op2.SelectedValue == "and NOT")
                {
                    SelectString += (FdSearch != "") ?  " not ItemName like '%" + FdSearch + "%'" : "";
                }
                else if ((DDL_WBS.SelectedItem.Text == "" || DDL_WBS.SelectedItem.Text == "-請選擇-") && FdSearch != "")
                {
                    SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%'" : "";
                }
                //SelectString += (DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") ?   " ItemKind like '%" + DDL_WBS.SelectedItem.Text + "%' and" : "";
                //SelectString += (DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-" || FdSearch != "" && DDL_Op2.SelectedValue == "NOT") ? DDL_Op2.SelectedValue : "";
                //SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%' " : "";

                // SelectString = (SelectString.Length > 1) ? " where " + SelectString + " ORDER BY [PriceID]" : "";
                //SelectString.Substring(0,SelectString.Length-4)
                if (SelectString != "")
                {
                    SqlDataSource2.SelectCommand = Sql + " and " + SelectString;
                }
                else
                {
                    SqlDataSource2.SelectCommand = Sql;
                }

                Sql = SqlDataSource2.SelectCommand;
                //GridView2.DataSource = (DataTable)Session["DataTable"];
                GridView1.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請重新選擇標案');", true);
            }
        }
예제 #17
0
        protected void BtRetainingSearch_Click(object sender, EventArgs e)
        {
            string database  = Session["DatabaseName"].ToString();
            string Retaining = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxRetaining.Text));

            string SelectString = "";

            SelectString = (Retaining != "") ? "RetainingName like '%" + Retaining + "%' " : "";
            SelectString = (SelectString.Length > 1) ? "where " + SelectString : "";

            SqlDataSource3.SelectCommand += SelectString;
            GridView3.DataBind();
        }
예제 #18
0
        protected void FdSearch_Click(object sender, EventArgs e)
        {
            string database = Session["DatabaseName"].ToString();
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxFdSearch.Text));

            string SelectString = "";

            SelectString = (FdSearch != "") ? "FoundationName like '%" + FdSearch + "%' " : "";
            SelectString = (SelectString.Length > 1) ? "where " + SelectString : "";

            SqlDataSource4.SelectCommand += SelectString;
            GridView2.DataBind();
        }
예제 #19
0
        //取得建入資料
        protected DataTable GetDataBox()
        {
            string    database     = Session["DatabaseName"].ToString();
            DataTable DataTableBox = new DataTable();

            foreach (string DataName in SQLString.Split(','))
            {
                DataTableBox.Columns.Add(DataName, typeof(string));
            }


            //後台功能,必需要有的欄位名稱

            DataRow DataTableDr = DataTableBox.NewRow();

            string TopWBS = DDLTop.SelectedValue;
            //string Next = DDLNext.SelectedValue;
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxItemName.Text));
            string Notes    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxNotes.Text));

            #region 內容設定
            if (Session["ProjectCode"] != null)
            {
                LbNext.Text        = LbNext.Text != "" ? LbNext.Text : "1";
                DataTableDr["pid"] = Session["ProjectCode"].ToString();

                DataTableDr["LayerNum"]   = DDLLayer.SelectedValue;
                DataTableDr["UpperWID"]   = DDLTop.SelectedValue;
                DataTableDr["SortNum"]    = LbNext.Text;
                DataTableDr["ItemKind"]   = DDLKind.SelectedValue;
                DataTableDr["ItemName"]   = ItemName;
                Session["thisID"]         = Session["thisID"] != null ? Session["thisID"].ToString() : "";
                DataTableDr["PriceID"]    = Session["thisID"].ToString() != ""?Session["thisID"].ToString():"";
                DataTableDr["Unit"]       = DDL_Unit.SelectedValue;
                DataTableDr["Notes"]      = Notes;
                DataTableDr["NewItem"]    = "1";
                DataTableDr["ResourceNY"] = "1";

                //SortNum = int.Parse(DDLNext.SelectedValue);
                DataTableBox.Rows.Add(DataTableDr);
                #endregion

                SQLUpdateSort = "update EBudget_WBS set sortnum=SortNum+1 where LayerNum=" + DDLLayer.SelectedValue + " and UpperWID=" + DDLTop.SelectedValue + " and SortNum >=" + LbNext.Text + "";
                WebModel.SQLAction(database, SQLUpdateSort);
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true);
            }
            return(DataTableBox);
        }
예제 #20
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            //ViewState["all"] = false;
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            //Session["FdSearch"] = FdSearch;
            Sql = "";
            string SelectString = "";

            if (PriceID == "")
            {
                PriceID = "0";
            }
            SqlDataSource1.SelectCommand = "select * from  Bid_Library where  BID=" + Session["Bid"].ToString() + " AND PriceID not in (select KidID from Bid_AnaRelation where ParentID=" + PriceID + ") and PriceID<>" + PriceID + "";
            Sql = SqlDataSource1.SelectCommand;
            //Sql = SqlDataSource1.SelectCommand;
            //SelectString = (DDL_Res.SelectedValue == "1") ? "Complex = " + DDL_Res.SelectedValue + " " : "Complex != 1 ";
            //SelectString += (FdSearch != "") ? "" + DDL_Op2.SelectedValue + " ItemName like '%" + FdSearch + "%' " : "";
            //SelectString = (SelectString.Length > 1) ? " and " + SelectString + " " : "";
            SelectString = (DDL_Res.SelectedItem.Text != "" && DDL_Res.SelectedItem.Text != "-請選擇-") ? "ItemKind like '%" + DDL_Res.SelectedItem.Text + "%'" : "";
            if ((DDL_Res.SelectedItem.Text != "" && DDL_Res.SelectedItem.Text != "-請選擇-") && FdSearch == "")
            {
                SelectString += "";
            }
            else if ((DDL_Res.SelectedItem.Text != "" && DDL_Res.SelectedItem.Text != "-請選擇-") && FdSearch != "")
            {
                SelectString += DDL_Op2.SelectedValue + " ItemName like '%" + FdSearch + "%'";
            }
            else if ((DDL_Res.SelectedItem.Text == "" || DDL_Res.SelectedItem.Text == "-請選擇-") && FdSearch != "" && DDL_Op2.SelectedValue == "and NOT")
            {
                SelectString += (FdSearch != "") ? "not ItemName like '%" + FdSearch + "%'" : "";
            }
            else if ((DDL_Res.SelectedItem.Text == "" || DDL_Res.SelectedItem.Text == "-請選擇-") && FdSearch != "")
            {
                SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%'" : "";
            }
            //Sql += SelectString;
            if (SelectString != "")
            {
                SqlDataSource1.SelectCommand = Sql + " and " + SelectString;
            }
            else
            {
                SqlDataSource1.SelectCommand = Sql;
            }
            //Session["search"] = true;
            Sql = SqlDataSource1.SelectCommand;
            //Response.Redirect("ResourceLink.aspx?PriceID=" + PriceID+"");
            GridView1.DataBind();
        }
예제 #21
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string database = Session["DatabaseName"].ToString();
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            string SelectString = "";

            SelectString  = (DDL_WBS.SelectedValue != "0") ? "Code like '%" + DDL_WBS.SelectedValue + "%' " + DDL_Op2.SelectedValue + "" : "";
            SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%' " : "";
            SelectString  = (SelectString.Length > 1) ? " where " + SelectString + " ORDER BY [PriceID]" : "";

            SqlDataSource2.SelectCommand += SelectString;
            GridView2.DataSource          = (DataTable)Session["DataTable"];
            GridView2.DataBind();
        }
예제 #22
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(SrItemName.Text));

            string SelectString = "";

            Sql           = "SELECT *  FROM PrivateResource ";
            SelectString  = (DDL_kind.SelectedValue != "0") ? "ItemKind = '" + DDL_kind.SelectedValue + "' " + DDL_Op2.SelectedValue + "" : " ";
            SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%' and" : "";
            SelectString  = (SelectString.Length > 1) ? " Where " + SelectString.Substring(0, SelectString.Length - 4) + " ORDER BY PriceID DESC" : "";

            Sql += SelectString;
            SqlDataSource3.SelectCommand = Sql;
            GridView2.DataBind();
        }
예제 #23
0
        protected void BtnSearchRe_Click(object sender, EventArgs e)
        {
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxReItamName.Text));

            string SQRstring = "";

            SQRstring += (ItemName != "") ? "and ItemName like '%" + ItemName + "%' " : "";

            string SqlSelect = (SQRstring.Length > 1) ? Sql1 + SQRstring + "" : "";

            SqlDataSource1.SelectCommand = SqlSelect;
            Sql = SqlSelect;
            ViewState["Sql"] = SqlSelect;
            GridView1.DataBind();
        }
예제 #24
0
        protected void RsSearch_Click(object sender, EventArgs e)
        {
            Sql1 = "";
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(RsKeyWord.Text));

            string SelectString = "";

            Sql1          = "SELECT * FROM [Pro_Resource] WHERE [PID] =" + Session["ProjectCode"].ToString() + "";
            SelectString  = (DDL_RsKind.SelectedValue != "0") ? "ItemKind = '" + DDL_RsKind.SelectedValue + "' " + DDL_Op1.SelectedValue + "" : " ";
            SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%'  and" : "";
            SelectString  = (SelectString.Length > 1) ? "and " + SelectString.Substring(0, SelectString.Length - 4) + " ORDER BY PriceID Asc" : "";

            Sql1 += SelectString;
            SqlDataSource4.SelectCommand = Sql1;
            GridView1.DataBind();
        }
예제 #25
0
        protected void BtnWBSSearch_Click(object sender, EventArgs e)
        {
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxWBSSearch.Text));

            //string Sql = "Select * from PrivateResource";
            string SQRstring = "";

            SQRstring += (ItemName != "") ? "and ItemName like '%" + ItemName + "%'" : "";

            string SqlSelect = (SQRstring.Length > 1) ? Sql1 + SQRstring + "" : "";

            SqlDataSource2.SelectCommand = SqlSelect;
            Sql1 = SqlSelect;
            ViewState["Sql1"] = SqlSelect;
            GridView2.DataBind();
        }
예제 #26
0
        //取得建入資料
        protected DataTable GetDataBox()
        {
            string    database     = Session["DatabaseName"].ToString();
            DataTable DataTableBox = new DataTable();

            foreach (string DataName in SQLString.Split(','))
            {
                DataTableBox.Columns.Add(DataName, typeof(string));
            }


            //後台功能,必需要有的欄位名稱

            DataRow DataTableDr = DataTableBox.NewRow();

            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxItemName.Text));
            string Notes    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxNotes.Text));

            #region 內容設定
            if (Session["ProjectCode"] != null)
            {
                DataTableDr["pid"]      = Session["ProjectCode"].ToString();
                DataTableDr["ItemKind"] = DDLKind.SelectedValue;
                DataTableDr["ItemName"] = ItemName;
                if (DDLKind.SelectedValue == "x1")
                {
                    DataTableDr["Complex"] = 1;
                }
                else
                {
                    DataTableDr["Complex"] = 0;
                }
                DataTableDr["Unit"]  = DDL_Unit.SelectedValue;
                DataTableDr["Notes"] = Notes;

                //SortNum = int.Parse(DDLNext.SelectedValue);
                DataTableBox.Rows.Add(DataTableDr);
                #endregion
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true);
            }

            return(DataTableBox);
        }
예제 #27
0
        //取得建入資料
        protected DataTable GetDataBox()
        {
            string    database     = Session["DatabaseName"].ToString();
            DataTable DataTableBox = new DataTable();

            foreach (string DataName in SQLString.Split(','))
            {
                DataTableBox.Columns.Add(DataName, typeof(string));
            }


            //後台功能,必需要有的欄位名稱

            DataRow DataTableDr = DataTableBox.NewRow();

            string TopWBS   = DDLDtUpper.SelectedValue;
            string Next     = DDLNext.SelectedValue;
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxItemName.Text));

            //string Notes = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxNotes.Text));
            #region 內容設定
            if (Session["bid"] != null)
            {
                DataTableDr["bid"] = Session["bid"].ToString();

                DataTableDr["LayerNum"] = DDLLayer.SelectedValue;
                DataTableDr["UpperUID"] = DDLDtUpper.SelectedValue;
                DataTableDr["SortNum"]  = int.Parse(DDLNext.SelectedValue) != 0?int.Parse(DDLNext.SelectedValue):1;
                DataTableDr["ItemKind"] = DDLKind.SelectedValue;
                DataTableDr["ItemName"] = ItemName;
                DataTableDr["Unit"]     = DDL_Unit.SelectedValue;
                DataTableDr["PriceID"]  = PriceID;

                SortNum = int.Parse(DDLNext.SelectedValue);
                DataTableBox.Rows.Add(DataTableDr);
                #endregion

                SQLUpdateSort = "update Bid_WBS set sortnum=SortNum+1 where LayerNum=" + DDLLayer.SelectedValue + " and UpperUID=" + DDLDtUpper.SelectedValue + " and SortNum >=" + DDLNext.SelectedValue + " and Bid=" + Session["Bid"].ToString();
                bool result = WebModel.SQLAction(database, SQLUpdateSort);
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true);
            }
            return(DataTableBox);
        }
예제 #28
0
        public bool datacheck(string data1, string unit)
        {
            string database = Session["DatabaseName"].ToString();
            //string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxItemName.Text));
            DataTable DataTableBox = new DataTable(); //建立表格
            string    SQLString    = "select * from " + _TableName + " a ";

            #region 搜尋條件
            string SelectString = "";
            //SelectString = (ItemName != "") ? "ItemName like @SelectKey and " : "";
            SelectString += (data1 != "") ? "ItemName ='" + SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(data1)) + "' and " : "";
            SelectString += (unit != "") ? "Unit like '" + SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(unit)) + "'  and" : "";
            SelectString  = (SelectString.Length > 1) ? "where " + SelectString.Substring(0, SelectString.Length - 4) + " and bid=" + Session["Bid"].ToString() + "" : "";
            #endregion

            #region 找出總筆數

            //搜尋資料表

            //int AllList = 0;
            using (SqlConnection L_Conn = new SqlConnection(Utility.DBconnection.connect_string(database)))
            {
                using (SqlCommand SelectList = new SqlCommand(SQLString + SelectString, L_Conn))
                {
                    //SelectList.Parameters.AddWithValue("@SelectKey", "%" + ItemName + "%");
                    //SelectList.Parameters.AddWithValue("@SelectKey1", "%" + SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(data1)) + "%");
                    //SelectList.Parameters.AddWithValue("@SelectKey2", "%" + SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(unit)) + "%");
                    SelectList.CommandType = CommandType.Text;
                    L_Conn.Open();
                    SqlDataReader SelectList_read = SelectList.ExecuteReader();
                    DataTableBox = new DataTable();
                    DataTableBox.Load(SelectList_read);
                }
            }
            #endregion

            if (DataTableBox != null && DataTableBox.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #29
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            //string database = "[PublicDB].[dbo].[PublicResource]";
            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            SqlDataSource2.SelectCommand = "";
            Sql = "Select * from PrivateResource";
            //if (Session["bid"] != null)
            //{
            string SelectString = "";

            //SelectString = (DDL_WBS.SelectedValue != "0") ? "Code like '%" + DDL_WBS.SelectedValue + "%' " + DDL_Op2.SelectedValue + "" : "";
            SelectString = (DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") ? "ItemKind like '%" + DDL_WBS.SelectedItem.Text + "%'" : "";
            if ((DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") && FdSearch == "")
            {
                SelectString += "";
            }
            else if ((DDL_WBS.SelectedItem.Text != "" && DDL_WBS.SelectedItem.Text != "-請選擇-") && FdSearch != "")
            {
                SelectString += DDL_Op2.SelectedValue + " ItemName like '%" + FdSearch + "%'";
            }
            else if ((DDL_WBS.SelectedItem.Text == "" || DDL_WBS.SelectedItem.Text == "-請選擇-") && FdSearch != "" && DDL_Op2.SelectedValue == "and NOT")
            {
                SelectString += (FdSearch != "") ?  " not ItemName like '%" + FdSearch + "%'" : "";
            }
            else if ((DDL_WBS.SelectedItem.Text == "" || DDL_WBS.SelectedItem.Text == "-請選擇-") && FdSearch != "")
            {
                SelectString += (FdSearch != "") ? " ItemName like '%" + FdSearch + "%'" : "";
            }

            // SelectString = (SelectString.Length > 1) ? " where " + SelectString + " ORDER BY [PriceID]" : "";
            //SelectString.Substring(0,SelectString.Length-4)
            if (SelectString != "")
            {
                SqlDataSource2.SelectCommand = Sql + "where " + SelectString;
            }
            else
            {
                SqlDataSource2.SelectCommand = Sql;
            }

            Sql = SqlDataSource2.SelectCommand;
            //GridView2.DataSource = (DataTable)Session["DataTable"];
            GridView1.DataBind();
        }
예제 #30
0
        protected void BtnFSearch_Click(object sender, EventArgs e)
        {
            string database = Session["DatabaseName"].ToString();
            string ItemName = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxPro.Text));

            #region 搜尋條件
            string SelectString = "";

            SelectString = (DDL_Select2.SelectedValue != "0") ? "Type like '%" + DDL_Select2.SelectedValue + "%' " : "";

            SelectString += (ItemName != "") ? "" + DDL_Op2.SelectedValue + " SupportItem like '%" + ItemName + "%' " : "";

            SelectString = (SelectString.Length > 1) ? SelectString : "";
            #endregion
            SqlDataSource4.SelectCommand  = (SelectString.Length > 1) ? SqlDataSource4.SelectCommand.Substring(0, SqlDataSource4.SelectCommand.Length) : SqlDataSource4.SelectCommand;
            SqlDataSource4.SelectCommand += " where " + SelectString + "";
            GridView4.DataBind();
        }