Пример #1
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;
        }
Пример #2
0
        public bool datacheck()
        {
            string database  = Session["DatabaseName"].ToString();
            string SQLString = "Select * from EBudget_Change_Detail where EWID=" + SystemSet.GetRequestSet("EWID") + "";

            if (Session["ProjectCode"] == null)
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true);
            }
            else
            {
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        UId = row["UID"].ToString();
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Пример #3
0
        protected void Loadcontent()
        {
            string database = Session["DatabaseName"].ToString();

            if (SystemSet.GetRequestSet("PriceID") != "")
            {
                string SQLString = "Select a.*,b.* from BidM0 a left join  Bid_Library b on a.bid=b.bid  where b.PriceID ='" + SystemSet.GetRequestSet("PriceID") + "'";//left join RFQ_Material c  on b.PriceID=c.PriceID
                string SQLSelect = "Select PriceID,ItemName,Unit,Code,Amount from Bid_Library where  PriceID ='" + SystemSet.GetRequestSet("PriceID") + "'";
                //string SQLSelect = "SELECT DISTINCT a.PriceID, a.ItemName, a.Unit, a.Amount, a.Code,b.Explan,b.Note FROM Bid_Library a left join RFQ_Material b on a.PriceID=b.PriceID WHERE  a.BID  =" +Session["BID"].ToString() + " and b.PriceID ='" + SystemSet.GetRequestSet("PriceID") + "'";
                DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQLSelect);
                DataTable DataTableBox  = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbBidName.Text = row["BidName"].ToString();
                        BidName.Text   = row["BidName"].ToString();
                        //LbItemName.Text = row["ItemName"].ToString();
                        //LbUnit.Text = row["Unit"].ToString();
                        //LbCode.Text = row["Code"].ToString();
                        //LbNumber.Text = row["AnaNumber"].ToString();
                    }

                    Repeater1.DataSource = DataTableBox1;
                    Repeater1.DataBind();
                    Session["DataTable"] = DataTableBox1;
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CWID = SystemSet.GetRequestSet("CWid");
            string database = Session["DatabaseName"].ToString();

            //SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                Session["DataTable"] = null;
                string CWID1 = WebModel.SItemName(database, SQLStringEBg, "CWID");
                SQLStringCBg   = "Select  *  from CBudget_WBS where CWID=" + CWID1 + "";
                LbCNumber.Text = WebModel.SItemName(database, SQLStringCBg, "CNumber");

                string    SQLselect = "Select [PID],[LayerCode],[LayerNum],[UpperWID],[SortNum],[ItemOrder],[ItemName],[Unit],[ItemKind],[ENumber],[EUnitPrice],[ExecuteKind],[EEdition],[ResourceCode] from EBudget_WBS where pid=" + Session["ProjectCode"].ToString() + " and UpperWID=" + CWID;
                DataTable dt        = WebModel.LoadSetContentData(database, SQLselect);
                Session["DataTable"] = dt;
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            LoadContent();
            if (Session["DataTable"] != null)
            {
                Repeater1.DataSource = (DataTable)Session["DataTable"];
            }
        }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ID = (SystemSet.GetRequestSet("ID") != "") ? SystemSet.GetRequestSet("ID") : "";
     if (!IsPostBack)
     {
         LoadContent();
     }
 }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
     if (SystemSet.GetRequestSet("RFQ_Code") != "")
     {
         SqlDataSource1.SelectCommand = "SELECT [Name], [Type], [Path], [UID] FROM [RFQ_File] where RFQ_Code ='" + SystemSet.GetRequestSet("RFQ_Code") + "' ORDER BY [UID]";
     }
     Loadcontent();
 }
Пример #7
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string database   = Session["DatabaseName"].ToString();
            int    NewSortNum = 0;
            int    ID_class   = Convert.ToInt32(e.CommandArgument);

            ID_class = ID_class % GridView1.PageSize;
            if (e.CommandName == "Select")
            {
                int    UID      = (int)GridView1.DataKeys[ID_class].Value;
                string PriceID  = ((Label)GridView1.Rows[ID_class].FindControl("PriceID")).Text.Trim();
                Label  ItemName = (Label)GridView1.Rows[ID_class].FindControl("ItemName");
                Session["PriceID"] = PriceID + "ξ" + ItemName.Text;

                if (ParentID != "")
                {
                    string SQLMaxSort = "Select MAX(SortNum) as SortNum  from  Pro_Resource a left join Pro_Analysis b on a.PriceID=b.KidID where  a.PID=" + Session["ProjectCode"].ToString() + " and b.ParentID =" + ParentID + "";

                    DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLMaxSort);
                    if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                    {
                        foreach (DataRow row in DataTableBox.Rows)
                        {
                            MaxSortNum = row["SortNum"].ToString();
                        }
                    }
                    NewSortNum = MaxSortNum != "" ? int.Parse(MaxSortNum) + 1 : 1;
                }


                if (ParentID != "")
                {
                    string SQLString = "insert into  Pro_Analysis  ([SortNum],[ParentID],[KidID]) VALUES(" + NewSortNum + "," + ParentID + ", " + PriceID + ")";
                    WebModel.SQLAction(database, SQLString);
                }
                else if (ParentID == "" && SystemSet.GetRequestSet("UID") != "")
                {
                    string SQLUdL   = "Update Pro_Resource set Complex=1 where PriceID=" + PriceID + "";
                    string SQLUdWBS = "Update EBudget_WBS set PriceID=" + PriceID + " where UID=" + SystemSet.GetRequestSet("UID") + "";
                    WebModel.SQLAction(database, SQLUdL);
                    WebModel.SQLAction(database, SQLUdWBS);
                }
                GridView1.DataBind();
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 已新增連結');", true);

                Response.Write("<script>window.opener.document.getElementById('callback').click();</script>");
                Response.Write("<script> window.close();</script>");
            }
            if (e.CommandName == "analyst")
            {
                int UID = (int)GridView1.DataKeys[ID_class].Value;
                Response.Write("<script>window.open('AnalysisV_BWBS.aspx?PriceId=" + UID + "','_blank')</script>");
            }
        }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LB_NormalPrice.Text = (SystemSet.GetRequestSet("TTPrice") != "") ? SystemSet.GetRequestSet("TTPrice") : "";
     if (!IsPostBack)
     {
         //decimal A = decimal.Parse(LB_NormalPrice.Text, System.Globalization.NumberStyles.Number);
         //decimal B = decimal.Parse(TB_Percent.Text, System.Globalization.NumberStyles.Number) / 100;
         //int C = (int)(A * B);
         //TB_Price.Text = Convert.ToString(C);
     }
 }
Пример #9
0
 protected void Button18_Click(object sender, EventArgs e)
 {
     Session["AddNew"] = "2";
     if (SystemSet.GetRequestSet("PriceID") != "")
     {
         OpenNewWindow("AddNewItem.aspx?PriceID=" + SystemSet.GetRequestSet("PriceID") + "", "1");
     }
     else if (SystemSet.GetRequestSet("UID") != "")
     {
         OpenNewWindow("AddNewItem.aspx?UID=" + SystemSet.GetRequestSet("UID") + "", "1");
     }
 }
Пример #10
0
 protected void DDL_BidSelect_SelectedIndexChanged(object sender, EventArgs e)
 {
     PlaceHolder1.Controls.Clear();
     Session["BID"] = DDL_BidSelect.SelectedItem.Value;
     DDL_BidSelect.SelectedValue = DDL_BidSelect.SelectedItem.Value;
     if (SystemSet.GetRequestSet("Bid") != "")
     {
         DDL_BidSelect.SelectedItem.Value = Session["Bid"].ToString();
     }
     Pnl_ALL.Visible = true;
     //ViewState["i"] = 0;
     //ViewState["ADDView"] = null;
     LoadContentView();
 }
Пример #11
0
        protected void Loadcontent()
        {
            string database = Session["DatabaseName"].ToString();
            string priceid  = SystemSet.GetRequestSet("PriceID");

            if (SystemSet.GetRequestSet("RFQ_Code") != "")
            {
                string    SQLString     = "select DISTINCT RFQ_Code,Name,ReplyDate,Warranty,Location,WorkManDep,WorkManName,Notes from [RFQ] where RFQ_Code='" + SystemSet.GetRequestSet("RFQ_Code") + "'";//left join RFQ_Material c  on b.PriceID=c.PriceID
                string    SQLSelect     = "select a.Name,b.*,c.*,d.*,e.BID,e.BidName from FirmM a left join RFQ b on a.UID=b.FirmID left join RFQ_Material c on b.FirmID = c.FirmID left join Bid_Library d on c.RFQ_Code=d.RFQ_Code left join BidM0 e on d.BID=e.BID where b.RFQ_Code='" + SystemSet.GetRequestSet("RFQ_Code") + "' and c.RFQ_Code='" + SystemSet.GetRequestSet("RFQ_Code") + "' and c.PriceID='" + SystemSet.GetRequestSet("PriceID") + "' and d.PriceID='" + SystemSet.GetRequestSet("PriceID") + "'";
                DataTable DataTableBox  = WebModel.LoadSetContentData(database, SQLString);
                DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQLSelect);

                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        RFQ_Code.Text    = row["RFQ_Code"].ToString();
                        LbName.Text      = row["Name"].ToString();
                        ReplyDate.Text   = row["ReplyDate"].ToString();
                        Warranty.Text    = row["Warranty"].ToString();
                        Location.Text    = row["Location"].ToString();
                        WorkManName.Text = row["WorkManName"].ToString();
                        Notes.Text       = row["Notes"].ToString();
                    }

                    //if (DataTableBox1 != null && DataTableBox1.Rows.Count > 0)
                    //{
                    //    foreach (DataRow row in DataTableBox1.Rows)
                    //    {

                    //        LbName.Text = row["Name"].ToString();
                    //        ExpiretionDate.Text = row["ExpiretionDate"].ToString();
                    //        ReplyDate.Text = row["ReplyDate"].ToString();
                    //        Warranty.Text = row["Warranty"].ToString();
                    //        Location.Text = row["Location"].ToString();
                    //        WorkManName.Text = row["WorkManName"].ToString();
                    //        Notes.Text = row["Notes"].ToString();

                    //    }
                    //}
                    Repeater1.DataSource = DataTableBox1;
                    Repeater1.DataBind();
                    Session["DataTable"] = DataTableBox1;
                }
            }
        }
Пример #12
0
        protected void LoadContent()
        {
            string database = Session["DatabaseName"].ToString();
            string SQLString;

            if (SystemSet.GetRequestSet("PriceID") != "")
            {
                SQLString = "select * from  Pro_Resource where PriceID=" + PriceID + "";
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbName.Text      = row["ItemName"].ToString();
                        LbUnit.Text      = row["Unit"].ToString();
                        LbCode.Text      = row["Code"].ToString();
                        LbAnaNumber.Text = row["AnaNumber"].ToString();
                        ParentID         = row["PriceID"].ToString();
                        //string PriceID1 = row["PriceID"].ToString();
                    }
                }
            }
            else
            {
                if (SystemSet.GetRequestSet("UID") != "")
                {
                    SQLString = "Select  *  from EBudget_WBS a left join  Pro_Resource b on a.PriceID = b.PriceID where a.WID=" + SystemSet.GetRequestSet("UID") + "";
                }
                else
                {
                    SQLString = "";
                }
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbName.Text      = row["ItemName"].ToString();
                        LbUnit.Text      = row["Unit"].ToString();
                        LbCode.Text      = row["Code"].ToString();
                        LbAnaNumber.Text = row["AnaNumber"].ToString();
                        ParentID         = row["PriceID"].ToString();
                    }
                }
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            SqlDataSource2.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            LoadContentView();
            if (SystemSet.GetRequestSet("Bid") != "")
            {
                Session["Bid"] = SystemSet.GetRequestSet("Bid");
                DDL_BidSelect.SelectedItem.Value = Session["Bid"].ToString();
                //PlaceHolder1.Controls.Clear();
                DDL_BidSelect_SelectedIndexChanged(this, null);
            }
            DropDownList DDL = (DropDownList)Master.FindControl("Ddl_Project");

            DDL.Visible = false;
        }
Пример #14
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"] == "")
     {
         ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請選擇專案');", true);
         Response.Redirect("Main.aspx");
     }
     CWID = SystemSet.GetRequestSet("CWID");
     LoadContent();
     LoadEBContent();
     if (!IsPostBack)
     {
         LoadDetail();
     }
 }
Пример #15
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (Session["BID"] != null)
            {
                int ID_class = Convert.ToInt32(e.CommandArgument);
                ID_class = ID_class % GridView1.PageSize;
                if (e.CommandName == "Select")
                {
                    int UID = (int)GridView1.DataKeys[ID_class].Value;

                    Label  PriceID  = (Label)GridView1.Rows[ID_class].FindControl("PriceID");
                    Label  ItemName = (Label)GridView1.Rows[ID_class].FindControl("ItemName");
                    Label  Code     = (Label)GridView1.Rows[ID_class].FindControl("Code");
                    Label  Unit     = (Label)GridView1.Rows[ID_class].FindControl("Unit");
                    Button Complex  = (Button)GridView1.Rows[ID_class].FindControl("Complex");
                    LossComplex.Visible = GridView1.Rows[ID_class].FindControl("Complex").Visible;

                    LossName.Text    = ItemName.Text;
                    LossUnit.Text    = Unit.Text;
                    LossComplex.Text = (LossComplex.Visible == true) ? "有單價分析" :  (LossComplex.Visible == false) ?"無單價分析":"";
                    LbPrice.Text     = PriceID.Text;
                }
                if (e.CommandName == "analyst")
                {
                    int   UID     = (int)GridView1.DataKeys[ID_class].Value;
                    Label PriceID = (Label)GridView1.Rows[ID_class].FindControl("PriceID");
                    if (PriceID.Text != "")
                    {
                        //OpenNewWindow("AnalysisV.aspx?PriceID=" + PriceID.Text + "", "1");
                        Response.Write("<script>window.open('AnalysisV.aspx?PriceID=" + PriceID.Text + "','_blank')</script>");
                    }
                    else if (SystemSet.GetRequestSet("UID") != "")
                    {
                        OpenNewWindow("AnalysisV.aspx?UID=" + SystemSet.GetRequestSet("UID") + "", "1");
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請選擇標案');", true);
            }
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CWID = SystemSet.GetRequestSet("CWid");
            string database = Session["DatabaseName"].ToString();

            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource2.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                SqlDataSource1.SelectCommand = Sql;
                Session["DataTable"]         = null;
                if (CWID != "")
                {
                    string CWID1 = WebModel.SItemName(database, SQLStringEBg, "CWID");
                    SQLStringCBg = "Select  *  from CBudget_WBS where CWID=" + CWID1 + "";
                    priceid      = WebModel.SItemName(database, SQLStringCBg, "PriceID");
                    if (priceid != "")
                    {
                        //SqlDataSource1.SelectCommand = "Select * From Pro_Analysis a left join Pro_Resource b on a.KidID=b.PriceID Where a.ParentID=" + priceid + "";
                        SqlDataSource1.SelectCommand = "Select * From PrivateResource ";
                    }
                }
                string    SQLselect = "Select [PID],[LayerCode],[LayerNum],[UpperWID],[SortNum],[ItemOrder],[PriceID],[ItemName],[Unit],[ItemKind],[ENumber],[LastENumber],[EUnitPrice],[Notes],[ExecuteKind],[EEdition],[order_Num],[ResourceCode] from EBudget_WBS where pid=" + Session["ProjectCode"].ToString() + " and UpperWID=" + CWID;
                DataTable dt        = WebModel.LoadSetContentData(database, SQLselect);
                Session["DataTable"] = dt;
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                //SqlDataSource1.SelectCommand = "Select * From PrivateResource ";
            }
            LoadContent();
            if (Session["DataTable"] != null)
            {
                Repeater1.DataSource = (DataTable)Session["DataTable"];
            }
            SqlDataSource1.SelectCommand = Sql;
            SqlDataSource2.SelectCommand = Sql1;
        }
Пример #17
0
        protected void LoadContent()
        {
            string database = Session["DatabaseName"].ToString();

            if (SystemSet.GetRequestSet("PriceID") != "")
            {
                string    SQLString    = "Select  *  from  Bid_Library where PriceID ='" + PriceID + "'";
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbName.Text = row["ItemName"].ToString();
                        LbUnit.Text = row["Unit"].ToString();
                        //LbCode.Text = row["Code"].ToString();
                        //LbAnaNumber.Text = row["AnaNumber"].ToString();
                        ParentID            = row["PriceID"].ToString();
                        Session["ParentID"] = ParentID;
                    }
                }
                SqlDataSource2.SelectCommand = "select * from  Bid_Library where  BID=" + Session["Bid"].ToString() + " AND PriceID not in (select KidID from Bid_AnaRelation where ParentID=" + Session["ParentID"].ToString() + ") and PriceID<>" + Session["ParentID"].ToString() + "";
            }
            else if (SystemSet.GetRequestSet("UID") != "")
            {
                string    SQLString    = "Select  *  from Bid_WBS a left join  Bid_Library b on a.PriceID = b.PriceID where a.UID='" + UID + "'";
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbName.Text = row["ItemName"].ToString();
                        LbUnit.Text = row["Unit"].ToString();
                        //LbCode.Text = row["Code"].ToString();
                        //LbAnaNumber.Text = row["Number"].ToString();
                        ParentID            = row["PriceID"].ToString();
                        Session["ParentID"] = ParentID;
                    }
                }
                SqlDataSource2.SelectCommand = "select * from  Bid_Library where  BID=" + Session["Bid"].ToString() + " AND PriceID not in (select KidID from Bid_AnaRelation where ParentID=" + Session["ParentID"].ToString() + ") and PriceID<>" + Session["ParentID"].ToString() + "";
            }
        }
Пример #18
0
        protected void LoadContent()
        {
            string database = Session["DatabaseName"].ToString();

            if (SystemSet.GetRequestSet("PriceID") != "")
            {
                string    SQLString    = "Select  *  from  Bid_Library where PriceID ='" + Session["PriceID"] + "'";
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbName.Text      = row["ItemName"].ToString();
                        LbUnit.Text      = row["Unit"].ToString();
                        LbCode.Text      = row["Code"].ToString();
                        LbAnaNumber.Text = row["AnaNumber"].ToString();
                        ParentID         = row["PriceID"].ToString();
                    }
                }
            }
            else
            {
                if (Session["uid"] != null)
                {
                    string    SQLString    = "Select  *  from Bid_WBS a left join  Bid_Library b on a.PriceID = b.PriceID where a.UID='" + Session["uid"].ToString() + "'";
                    DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                    if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                    {
                        foreach (DataRow row in DataTableBox.Rows)
                        {
                            LbName.Text      = row["ItemName"].ToString();
                            LbUnit.Text      = row["Unit"].ToString();
                            LbCode.Text      = row["Code"].ToString();
                            LbAnaNumber.Text = row["Number"].ToString();
                            ParentID         = row["PriceID"].ToString();
                        }
                    }
                }
            }
        }
Пример #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ID = (SystemSet.GetRequestSet("ID") != "") ? SystemSet.GetRequestSet("ID") : "";
            string database = Session["DatabaseName"].ToString();

            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
            {
                GetTitleList();
                GetDataList();
                LbSubNum.Text = ID;
                string SQLSubName = "Select * from SubBudgetList where SBID=" + ID;
                LbSubName.Text = WebModel.SItemName(database, SQLSubName, "SB_Name");
            }
        }
Пример #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null || (Session["ProjectCode"] == null)))
            {
                Response.Redirect("Main.aspx");
            }
            string database = Session["DatabaseName"].ToString();

            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (!IsPostBack)
            {
                //Session["search"] = false;
                SqlDataSource1.SelectCommand = Sql;

                LoadContent();
                if (PriceID == "")
                {
                    ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 目前尚未連結工料,是否新增連結?');", true);
                }
            }



            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 Pro_Analysis a left join Pro_Resource b on a.KidID=b.PriceID left join EBudget_WBS c on b.PriceID=c.PriceID where  b.PID=" + Session["ProjectCode"].ToString() + " order by A.SortNum";
            }

            string FdSearch = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSearch.Text));

            SqlDataSource1.SelectCommand = Sql;
        }
Пример #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                Session["DataTable"] = null;
                Loadcontent();

                Repeater1.DataBind();
            }
            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());
            SqlDataSource5.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource6.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource7.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource9.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            SqlDataSource8.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());

            if (Session["bid"] != null)
            {
                SqlDataSource4.SelectCommand = "SELECT PriceID, ItemName, Unit, Amount, Code FROM Bid_Library WHERE (BID = " + Session["bid"].ToString() + ")  ORDER BY Code DESC";                                              //AND (ResourceNY = @ResourceNY) AND (ItemKind =@ItemKind) AND (PriceID= @PriceID)
                SqlDataSource5.SelectCommand = "SELECT A.PriceID, A.ItemName, A.Unit, A.Amount, A.Code, B.BidName,A.BID FROM Bid_Library A LEFT JOIN BidM0 B ON A.BID = B.BID WHERE A.BID !=" + Session["Bid"].ToString() + " "; // AND (Bid_Library.ResourceNY = @ResourceNY) AND (Bid_Library.ItemKind &lt;&gt; @ItemKind) AND (Bid_Library.Code = @Code)
                SqlDataSource8.SelectCommand = "Select  *  from BidM0 a left join  Bid_Library b on a.bid=b.bid where PriceID ='" + SystemSet.GetRequestSet("PriceID") + "'";                                                    // AND (Bid_Library.ResourceNY = @ResourceNY) AND (Bid_Library.ItemKind &lt;&gt; @ItemKind) AND (Bid_Library.Code = @Code)
            }
            if (SystemSet.GetRequestSet("RFQ_Code") != "")
            {
                SqlDataSource9.SelectCommand = "SELECT [Name], [Type], [Path], [UID] FROM [RFQ_File] where RFQ_Code='" + SystemSet.GetRequestSet("RFQ_Code") + "' ORDER BY [UID]";
            }
            if (Session["DataTable"] != null)
            {
                Repeater1.DataSource = (DataTable)Session["DataTable"];
            }
        }
Пример #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string PriceID = (SystemSet.GetRequestSet("PriceID") != "") ? SystemSet.GetRequestSet("PriceID") : "";

            if ((Session["UserName"] == null) || (Session["CompanyName"] == null || Session["bid"] == null))
            {
                Response.Redirect("Login.aspx");
            }
            LoadContent();

            SqlDataSource1.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString());
            if (SystemSet.GetRequestSet("PriceID") != "")
            {
                SqlDataSource1.SelectCommand = "Select  *  from Bid_AnaRelation a left join Bid_Library b on  a.KidID=b.PriceID where  a.ParentID=" + PriceID + " and b.BID=" + Session["bid"].ToString() + " order by A.SortNum";
            }
            else if (ParentID != "")
            {
                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=" + ParentID + " and b.BID=" + Session["bid"].ToString() + " order by A.SortNum";
            }
            LoadTxCNumber();
            //Repeater1.DataSource = SqlDataSource1;
            //Repeater1.DataBind();
        }
Пример #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     EWID = SystemSet.GetRequestSet("EWID");
     if ((Session["UserName"] == null) || (Session["CompanyName"] == null))
     {
         Response.Redirect("Login.aspx");
     }
     LoadContent();
     LoadEBContent();
     if (!IsPostBack)
     {
         int    Eedition = 0;
         string database = Session["DatabaseName"].ToString();
         Eedition = WebModel.MaxAnyID(database, "EBudget_Change", Session["ProjectCode"].ToString(), "EEdition");
         if (ViewState["edition"] == null)
         {
             for (int i = 1; i <= Eedition; i++)
             {
                 CheckBoxList2.Items.Add(new ListItem("第" + i.ToString() + "變更設計", i.ToString()));
             }
         }
         LoadDetail();
     }
 }
Пример #24
0
 protected void BtnRecovery_Click(object sender, EventArgs e)
 {
     Response.Redirect("BidItemEdit.aspx?uid=" + SystemSet.GetRequestSet("UId"));
 }
Пример #25
0
        protected void LoadContentView()
        {
            OTotal.Text = "";
            BTotal.Text = "";
            CTotal.Text = "";
            if (Session["BID"] != null)
            {
                string database     = Session["DatabaseName"].ToString();
                string SQLStringNum = "Select  MAX(LayerNum) as id  from Bid_WBS where BID='" + Session["BID"].ToString() + "'";
                string SQLString    = "Select  *  from Bid_WBS a left join  Bid_Library b on a.PriceID = b.PriceID where a.BID='" + Session["BID"].ToString() + "' order by LayerCode";
                //DDLDtlLayer.SelectedValue
                DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQLString);
                DataTable DataTableBox  = WebModel.LoadSetContentData(database, SQLStringNum);
                DataTable Tablebox      = GetDataBox();
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbLayerNum = row["id"].ToString();
                    }

                    ViewState["rowNum"] = DataTableBox1.Rows.Count;
                    if (DataTableBox1 != null && DataTableBox1.Rows.Count > 0)
                    {
                        //PlaceHolder1.Controls.Clear();  //先清除所有子控制項
                        int     count = 0;
                        decimal x1    = 0;
                        decimal x2    = 0;
                        decimal x3    = 0;

                        foreach (DataRow row in DataTableBox1.Rows)
                        {
                            Label Texbox = new Label();
                            //Texbox.Width = 50;
                            string layer = row["LayerNum"].ToString();
                            if (layer == "")
                            {
                                PlaceHolder1.Controls.Add(new LiteralControl(" <tr id=" + count.ToString() + " class=\"TableSingle\"><td class=\"autoCenter\">"));
                                PlaceHolder1.Controls.Add(Texbox);
                                PlaceHolder1.Controls.Add(new LiteralControl("</td>"));
                            }
                            else
                            {
                                PlaceHolder1.Controls.Add(new LiteralControl("<tr id=tr" + count.ToString() + " class=\"TableSingle\">"));

                                for (int i = 1; i <= int.Parse(layer) - 1; i++)
                                {
                                    PlaceHolder1.Controls.Add(new LiteralControl("<td class='itemframe'  style='min-width:10px;border-left-style:none'></td>"));
                                }
                                int x = int.Parse(LbLayerNum) - int.Parse(layer) + 1;
                                PlaceHolder1.Controls.Add(new LiteralControl("<td colspan= " + x + ">"));
                                PlaceHolder1.Controls.Add(Texbox);
                                if (x == 0)
                                {
                                    PlaceHolder1.Controls.Add(new LiteralControl("</td>"));
                                }
                                else
                                {
                                    PlaceHolder1.Controls.Add(new LiteralControl("</td>"));
                                }
                            }

                            Label UID = new Label();
                            UID.ID      = "UID" + count.ToString();
                            UID.Visible = false;
                            Label NewItem = new Label();
                            PlaceHolder1.Controls.Add(NewItem);
                            NewItem.Visible = false;
                            NewItem.ID      = "NewItem" + count.ToString();
                            PlaceHolder1.Controls.Add(UID);
                            Texbox.ID = "Tx" + count.ToString();

                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td class=\"autoLeft\">"));
                            Label ItemName1 = new Label();
                            ItemName1.Width = 350;
                            ItemName1.ID    = "Name" + count.ToString();
                            PlaceHolder1.Controls.Add(ItemName1);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label Unit = new Label();
                            Unit.ID = "Unit" + count.ToString();
                            PlaceHolder1.Controls.Add(Unit);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td class=\"auto-style43\">"));
                            ImageButton ImgAnalyst = new ImageButton();
                            ImgAnalyst.Click   += ImgAnalyst_Click;
                            ImgAnalyst.ID       = "ImgAnalyst" + count.ToString();
                            ImgAnalyst.Visible  = (row["Complex"].ToString() == "1") ? true : false;
                            ImgAnalyst.ImageUrl = "~/img/Ana.jpg";

                            PlaceHolder1.Controls.Add(ImgAnalyst);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label Number = new Label();
                            Number.ID = "Num" + count.ToString();
                            PlaceHolder1.Controls.Add(Number);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label UnitPrice = new Label();
                            UnitPrice.ID = "UnitPrice" + count.ToString();
                            PlaceHolder1.Controls.Add(UnitPrice);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label Complexprice = new Label();
                            Complexprice.ID = "Complexprice" + count.ToString();
                            PlaceHolder1.Controls.Add(Complexprice);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label CNumber = new Label();
                            CNumber.ID = "CNumber" + count.ToString();
                            PlaceHolder1.Controls.Add(CNumber);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label CPrice = new Label();
                            CPrice.ID = "CPrice" + count.ToString();
                            PlaceHolder1.Controls.Add(CPrice);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label BNumber = new Label();
                            BNumber.ID = "BNumber" + count.ToString();
                            PlaceHolder1.Controls.Add(BNumber);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label BUnitPrice = new Label();
                            BUnitPrice.ID = "BUnitPrice" + count.ToString();
                            PlaceHolder1.Controls.Add(BUnitPrice);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label BCPrice = new Label();
                            BCPrice.ID = "BCPrice" + count.ToString();
                            PlaceHolder1.Controls.Add(BCPrice);
                            PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));
                            Label Notes = new Label();
                            Notes.ID = "Notes" + count.ToString();
                            PlaceHolder1.Controls.Add(Notes);
                            // PlaceHolder1.Controls.Add(new LiteralControl("</td><td>"));

                            PlaceHolder1.Controls.Add(new LiteralControl("</td></tr>"));


                            ItemName1.Text = row["ItemName"].ToString();
                            Unit.Text      = row["Unit"].ToString();
                            UnitPrice.Text = (row["UnitPrice"].ToString().Trim() != "") ? row["UnitPrice"].ToString().Trim() : "-";
                            //原標單數量
                            if (SystemSet.GetRequestSet("RBLRuleValue1") == "0" && SystemSet.GetRequestSet("TxDecmal1") != "")
                            {
                                decimal n1 = (row["Number"].ToString() != "")?decimal.Parse(row["Number"].ToString()) :0;
                                int     x  = int.Parse(SystemSet.GetRequestSet("TxDecmal1"));

                                Number.Text = (Number.Text != "0") ? Math.Round(n1, x).ToString("N" + x) : "-";

                                // Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Round(decimal.Parse(row["Number"].ToString()), int.Parse(SystemSet.GetRequestSet("TxDecmal1")))).ToString() : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue1") == "1")
                            {
                                Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["Number"].ToString()))).ToString("N") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue1") == "2")
                            {
                                Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["Number"].ToString()))).ToString("N") : "-";
                            }
                            else
                            {
                                Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["Number"].ToString()))).ToString("N") : "-";
                            }

                            //校核後數量
                            if (SystemSet.GetRequestSet("RBLRuleValue1") == "0" && SystemSet.GetRequestSet("TxDecmal1") != "")
                            {
                                decimal n1 = (row["CNumber"].ToString() != "") ? decimal.Parse(row["CNumber"].ToString()) : 0;
                                int     x  = int.Parse(SystemSet.GetRequestSet("TxDecmal1"));
                                CNumber.Text = (CNumber.Text != "0") ? Math.Round(n1, x).ToString("N" + x) : "-";

                                // Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Round(decimal.Parse(row["Number"].ToString()), int.Parse(SystemSet.GetRequestSet("TxDecmal1")))).ToString() : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue1") == "1")
                            {
                                CNumber.Text = (row["CNumber"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["CNumber"].ToString()))).ToString("N") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue1") == "2")
                            {
                                CNumber.Text = (row["CNumber"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["CNumber"].ToString()))).ToString("N") : "-";
                            }
                            else
                            {
                                CNumber.Text = (row["CNumber"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["CNumber"].ToString()))).ToString("N") : "-";
                            }
                            //CNumber.Text = (row["CNumber"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["CNumber"].ToString()))).ToString("#,#") : "-";


                            //原標單單價
                            if (SystemSet.GetRequestSet("RBLRuleValue2") == "0" && SystemSet.GetRequestSet("TxDecmal2") != "")
                            {
                                decimal n1 = (row["UnitPrice"].ToString() != "") ? decimal.Parse(row["UnitPrice"].ToString()) : 0;
                                int     x  = int.Parse(SystemSet.GetRequestSet("TxDecmal2"));
                                UnitPrice.Text = Math.Round(n1, x).ToString("N" + x);

                                // Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Round(decimal.Parse(row["Number"].ToString()), int.Parse(SystemSet.GetRequestSet("TxDecmal1")))).ToString() : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue2") == "1")
                            {
                                UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["UnitPrice"].ToString()))).ToString("N") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue2") == "2")
                            {
                                UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["UnitPrice"].ToString()))).ToString("N") : "-";
                            }
                            else
                            {
                                UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["UnitPrice"].ToString()))).ToString("N") : "-";
                            }
                            //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            Texbox.Text = row["ItemOrder"].ToString();
                            UID.Text    = row["uid"].ToString();
                            //Number.Text = (Number.Text != "-" && Number.Text != "") ? Number.Text : "0";
                            //UnitPrice.Text = (UnitPrice.Text != "-" && UnitPrice.Text !="") ? UnitPrice.Text : "0";
                            decimal Complexprice1 = (decimal.Parse((Number.Text != "-" && Number.Text != "") ? Number.Text : "0") * decimal.Parse((UnitPrice.Text != "-" && UnitPrice.Text != "") ? UnitPrice.Text : "0"));


                            //原標單複價
                            if (SystemSet.GetRequestSet("RBLRuleValue3") == "0" && SystemSet.GetRequestSet("TxDecmal3") != "")
                            {
                                //decimal n1 = decimal.Parse(Number.Text);
                                int x = int.Parse(SystemSet.GetRequestSet("TxDecmal3"));
                                Number.Text    = (Number.Text != "-") ? Number.Text : "0";
                                UnitPrice.Text = (UnitPrice.Text != "-") ? UnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(Number.Text) * decimal.Parse(UnitPrice.Text));
                                Complexprice.Text = Math.Round(n1, x).ToString("N" + x);
                                //Complexprice.Text = Convert.ToInt32(Math.Ceiling(decimal.Parse(Number.Text) * (decimal.Parse((UnitPrice.Text != "-") ? UnitPrice.Text : "0")))).ToString("#,#");
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue3") == "1")
                            {
                                Number.Text    = (Number.Text != "-") ? Number.Text : "0";
                                UnitPrice.Text = (UnitPrice.Text != "-") ? UnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(Number.Text) * decimal.Parse(UnitPrice.Text));
                                Complexprice.Text = Math.Ceiling(n1).ToString("N");

                                //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue3") == "2")
                            {
                                Number.Text    = (Number.Text != "-") ? Number.Text : "0";
                                UnitPrice.Text = (UnitPrice.Text != "-") ? UnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(Number.Text) * decimal.Parse(UnitPrice.Text));
                                Complexprice.Text = Math.Floor(n1).ToString("N");

                                //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            }
                            else
                            {
                                Number.Text    = (Number.Text != "-") ? Number.Text : "0";
                                UnitPrice.Text = (UnitPrice.Text != "-") ? UnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(Number.Text) * decimal.Parse(UnitPrice.Text));
                                Complexprice.Text = Math.Ceiling(n1).ToString("N");
                            }
                            //Complexprice.Text = Convert.ToInt32(Math.Ceiling(decimal.Parse(Number.Text) * (decimal.Parse((UnitPrice.Text != "-") ? UnitPrice.Text : "0")))).ToString("#,#");
                            decimal CPrice1 = (decimal.Parse((CNumber.Text != "-" && CNumber.Text != "") ? CNumber.Text : "0")) * (decimal.Parse((UnitPrice.Text != "-" && UnitPrice.Text != "") ? UnitPrice.Text : "0"));
                            //CPrice.Text = Convert.ToInt32(Math.Ceiling(decimal.Parse(CNumber.Text ) * (decimal.Parse((UnitPrice.Text != "-") ? UnitPrice.Text : "0")))).ToString("#,#");

                            //校核後複價
                            if (SystemSet.GetRequestSet("RBLRuleValue3") == "0" && SystemSet.GetRequestSet("TxDecmal3") != "")
                            {
                                //decimal n1 = decimal.Parse(Number.Text);
                                int x = int.Parse(SystemSet.GetRequestSet("TxDecmal3"));
                                CNumber.Text = (CNumber.Text != "-" && (CNumber.Text != "")) ? CNumber.Text : "0";
                                decimal n1 = (decimal.Parse(CNumber.Text) * decimal.Parse(UnitPrice.Text));
                                CPrice.Text = Math.Round(n1, x).ToString("N" + x);
                                //CPrice.Text = (decimal.Parse(CNumber.Text) * (decimal.Parse((UnitPrice.Text != "-") ? UnitPrice.Text : "0"))).ToString("#,#");
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue3") == "1")
                            {
                                CNumber.Text = (CNumber.Text != "-" && CNumber.Text != "") ? CNumber.Text : "0";
                                decimal n1 = (decimal.Parse(CNumber.Text) * decimal.Parse(UnitPrice.Text));
                                CPrice.Text = Math.Ceiling(n1).ToString("N");

                                //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue3") == "2")
                            {
                                CNumber.Text = (CNumber.Text != "-" && CNumber.Text != "") ? CNumber.Text : "0";
                                decimal n1 = (decimal.Parse(CNumber.Text) * decimal.Parse(UnitPrice.Text));
                                CPrice.Text = Math.Floor(n1).ToString("N");
                                //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            }
                            else
                            {
                                CNumber.Text = (CNumber.Text != "-" && CNumber.Text != "") ? CNumber.Text : "0";
                                decimal n1 = (decimal.Parse(CNumber.Text) * decimal.Parse(UnitPrice.Text));
                                CPrice.Text = Math.Ceiling(n1).ToString("N");
                            }



                            //投標預算數量
                            if (SystemSet.GetRequestSet("RBLRuleValue1") == "0" && SystemSet.GetRequestSet("TxDecmal1") != "")
                            {
                                decimal n1 = (row["BNumber"].ToString() != "") ? decimal.Parse(row["BNumber"].ToString()) : 0;
                                int     x  = int.Parse(SystemSet.GetRequestSet("TxDecmal1"));
                                BNumber.Text = Math.Round(n1, x).ToString("N" + x);

                                // Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Round(decimal.Parse(row["Number"].ToString()), int.Parse(SystemSet.GetRequestSet("TxDecmal1")))).ToString() : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue1") == "1")
                            {
                                BNumber.Text = (row["BNumber"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["BNumber"].ToString()))).ToString("N") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue1") == "2")
                            {
                                BNumber.Text = (row["BNumber"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["BNumber"].ToString()))).ToString("N") : "-";
                            }
                            else
                            {
                                BNumber.Text = (row["BNumber"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["BNumber"].ToString()))).ToString("N") : "-";
                            }
                            //BNumber.Text = (row["BNumber"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["BNumber"].ToString()))).ToString("#,#") : "-";

                            //投標預算單價
                            if (SystemSet.GetRequestSet("RBLRuleValue2") == "0" && SystemSet.GetRequestSet("TxDecmal2") != "")
                            {
                                decimal n1 = (row["BUnitPrice"].ToString() != "") ? decimal.Parse(row["BUnitPrice"].ToString()) : 0;
                                int     x  = int.Parse(SystemSet.GetRequestSet("TxDecmal2"));
                                BUnitPrice.Text = Math.Round(n1, x).ToString("N" + x);

                                // Number.Text = (row["Number"].ToString() != "") ? Convert.ToInt32(Math.Round(decimal.Parse(row["Number"].ToString()), int.Parse(SystemSet.GetRequestSet("TxDecmal1")))).ToString() : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue2") == "1")
                            {
                                BUnitPrice.Text = (row["BUnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["BUnitPrice"].ToString()))).ToString("N") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue2") == "2")
                            {
                                BUnitPrice.Text = (row["BUnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["BUnitPrice"].ToString()))).ToString("N") : "-";
                            }
                            else
                            {
                                BUnitPrice.Text = (row["BUnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["BUnitPrice"].ToString()))).ToString("N") : "-";
                            }
                            //BUnitPrice.Text = (row["BUnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["BUnitPrice"].ToString()))).ToString("#,#") : "-";
                            decimal BCPrice1 = (decimal.Parse((BNumber.Text != "-" && BNumber.Text != "") ? BNumber.Text : "0")) * (decimal.Parse((BUnitPrice.Text != "-" && BUnitPrice.Text != "") ? BUnitPrice.Text : "0"));
                            //BCPrice.Text = Convert.ToInt32(Math.Ceiling(decimal.Parse(BNumber.Text) * decimal.Parse(BUnitPrice.Text))).ToString("#,#");
                            //投標預算複價
                            if (SystemSet.GetRequestSet("RBLRuleValue3") == "0" && SystemSet.GetRequestSet("TxDecmal3") != "")
                            {
                                //decimal n1 = decimal.Parse(Number.Text);
                                int x = int.Parse(SystemSet.GetRequestSet("TxDecmal3"));
                                BNumber.Text    = (BNumber.Text != "-" && BNumber.Text != "") ? BNumber.Text : "0";
                                BUnitPrice.Text = (BUnitPrice.Text != "-" && BUnitPrice.Text != "") ? BUnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(BNumber.Text) * decimal.Parse(BUnitPrice.Text));
                                BCPrice.Text = Math.Round(n1, x).ToString("N" + x);
                                //CPrice.Text = (decimal.Parse(CNumber.Text) * (decimal.Parse((UnitPrice.Text != "-") ? UnitPrice.Text : "0"))).ToString("#,#");
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue3") == "1")
                            {
                                BNumber.Text    = (BNumber.Text != "-" && BNumber.Text != "") ? BNumber.Text : "0";
                                BUnitPrice.Text = (BUnitPrice.Text != "-" && BUnitPrice.Text != "") ? BUnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(BNumber.Text) * decimal.Parse(BUnitPrice.Text));
                                BCPrice.Text = Math.Ceiling(n1).ToString("N");

                                //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Ceiling(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue3") == "2")
                            {
                                BNumber.Text    = (BNumber.Text != "-" && BNumber.Text != "") ? BNumber.Text : "0";
                                BUnitPrice.Text = (BUnitPrice.Text != "-" && BUnitPrice.Text != "") ? BUnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(BNumber.Text) * decimal.Parse(BUnitPrice.Text));
                                BCPrice.Text = Math.Floor(n1).ToString("N");
                                //UnitPrice.Text = (row["UnitPrice"].ToString() != "") ? Convert.ToInt32(Math.Floor(decimal.Parse(row["UnitPrice"].ToString()))).ToString("#,#") : "-";
                            }
                            else
                            {
                                BNumber.Text    = (BNumber.Text != "-" && BNumber.Text != "") ? BNumber.Text : "0";
                                BUnitPrice.Text = (BUnitPrice.Text != "-" && BUnitPrice.Text != "") ? BUnitPrice.Text : "0";
                                decimal n1 = (decimal.Parse(BNumber.Text) * decimal.Parse(BUnitPrice.Text));
                                BCPrice.Text = Math.Ceiling(n1).ToString("N");
                            }

                            Notes.Text   = row["Notes"].ToString();
                            NewItem.Text = row["NewItem"].ToString();

                            if (NewItem.Text == "1")
                            {
                                javauid     = "tr" + count;
                                ShowString += javauid + ",";


                                Page.ClientScript.RegisterStartupScript(this.GetType(), "hide", "<script language=JavaScript>hide_tr();</script>");
                            }

                            x1 += Complexprice1;
                            x2 += CPrice1;
                            x3 += BCPrice1;

                            count++;


                            this.ViewState["ADDView"] = true;
                            if (SystemSet.GetRequestSet("RBLRuleValue4") == "0" && SystemSet.GetRequestSet("TxDecmal4") != "")
                            {
                                //decimal n1 = decimal.Parse(Number.Text);
                                int x = int.Parse(SystemSet.GetRequestSet("TxDecmal4"));
                                OTotal.Text = Math.Round(x1, x).ToString("N" + x);
                                CTotal.Text = Math.Round(x2, x).ToString("N" + x);
                                BTotal.Text = Math.Round(x3, x).ToString("N" + x);
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue4") == "1")
                            {
                                //int x = int.Parse(SystemSet.GetRequestSet("TxDecmal3"));
                                OTotal.Text = Convert.ToInt32(Math.Ceiling(x1)).ToString("N");
                                CTotal.Text = Convert.ToInt32(Math.Ceiling(x2)).ToString("N");
                                BTotal.Text = Convert.ToInt32(Math.Ceiling(x3)).ToString("N");
                            }
                            else if (SystemSet.GetRequestSet("RBLRuleValue4") == "2")
                            {
                                OTotal.Text = Convert.ToInt32(Math.Floor(x1)).ToString("N");
                                CTotal.Text = Convert.ToInt32(Math.Floor(x2)).ToString("N");
                                BTotal.Text = Convert.ToInt32(Math.Floor(x3)).ToString("N");
                            }
                            else
                            {
                                OTotal.Text = Convert.ToInt32(Math.Ceiling(x1)).ToString("N");
                                CTotal.Text = Convert.ToInt32(Math.Ceiling(x2)).ToString("N");
                                BTotal.Text = Convert.ToInt32(Math.Ceiling(x3)).ToString("N");
                            }

                            //for (int i = 0; i < DataTableBox1.Rows.Count; i++)
                            //{
                            DataRow DataTableDr = Tablebox.NewRow();
                            //DataTableDr["bid"] = Session["bid"].ToString();

                            DataTableDr["UID"]          = UID.Text;
                            DataTableDr["ItemOrder"]    = Texbox.Text;
                            DataTableDr["NewItem"]      = NewItem.Text;
                            DataTableDr["Name"]         = ItemName1.Text;
                            DataTableDr["Unit"]         = Unit.Text;
                            DataTableDr["Complex"]      = ImgAnalyst.Visible;
                            DataTableDr["Number"]       = Number.Text;
                            DataTableDr["UnitPrice"]    = UnitPrice.Text;
                            DataTableDr["Complexprice"] = Complexprice.Text;
                            DataTableDr["CNumber"]      = CNumber.Text;
                            DataTableDr["CPrice"]       = CPrice.Text;
                            DataTableDr["BNumber"]      = BNumber.Text;
                            DataTableDr["BUnitPrice"]   = BUnitPrice.Text;
                            DataTableDr["BCPrice"]      = BCPrice.Text;
                            DataTableDr["Notes"]        = Notes.Text;


                            Tablebox.Rows.Add(DataTableDr);
                            //}
                        }
                        Session["PlaceHolder"] = Tablebox;
                        // DataTableBox.Dispose(); //釋放Table資源
                    }
                }
            }
        }
Пример #26
0
        protected void LoadContent()
        {
            string database = Session["DatabaseName"].ToString();

            if (PriceID != "" && WUID == "")
            {
                string    SQLString    = "Select  *  from  Bid_Library b  where PriceID ='" + SystemSet.GetRequestSet("PriceID") + "'";
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        LbName.Text      = row["ItemName"].ToString();
                        LbUnit.Text      = row["Unit"].ToString();
                        LbCode.Text      = row["Code"].ToString();
                        LbAnaNumber.Text = row["AnaNumber"].ToString();
                        ParentID         = row["PriceID"].ToString();
                    }
                }
            }
            else
            {
                string    SQLString    = "Select  *  from Bid_WBS a left join  Bid_Library b on a.PriceID = b.PriceID where a.UID='" + WUID + "'";
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString);
                string    Bid;
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        Bid = row["Bid"].ToString();
                        string    SQL           = "Select  *  from Bid_WBS Where bid=" + Bid;
                        DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQL);
                        int[]     UID           = new int[DataTableBox1.Rows.Count];
                        int[]     UpperUID      = new int[DataTableBox1.Rows.Count];
                        string[]  ItemOrder     = new string[DataTableBox1.Rows.Count];
                        if (DataTableBox1 != null && DataTableBox1.Rows.Count > 0)
                        {
                            int count = 0;
                            foreach (DataRow rows in DataTableBox1.Rows)
                            {
                                UID[count]       = int.Parse(rows["UID"].ToString());
                                ItemOrder[count] = rows["ItemOrder"].ToString();
                                if (rows["UpperUID"].ToString() == "")
                                {
                                    UpperUID[count] = 0;
                                }
                                else
                                {
                                    UpperUID[count] = int.Parse(rows["UpperUID"].ToString());
                                }
                                //UpperUID[count]=(row["UpperUID"]==null)?0:int.Parse(row["UpperUID"].ToString());
                                count++;
                            }
                        }

                        //LbItemOrder.Text = row["ItemOrder"].ToString();
                        LbName.Text      = row["ItemName"].ToString();
                        LbUnit.Text      = row["Unit"].ToString();
                        LbCode.Text      = row["Code"].ToString();
                        LbAnaNumber.Text = row["AnaNumber"].ToString();
                        ParentID         = row["PriceID"].ToString();
                        LbItemOrder.Text = WebModel.gen_OrderCode(int.Parse(Session["uid"].ToString()), UID, UpperUID, ItemOrder);
                    }
                }
            }
        }