public static string Get_Order(string dbname, string BID, string UID, string UpperUID, string order_Num, string SortNum) { string result = ""; //string SelectUID = "Select uid from Bid_WBS where UpperUID=" + UpperUID + " and BID=" + BID; //string UID = WebModel.SItemName(dbname, SelectUID, "UID"); //string SelectOrder_Num="Select order_Num from Bid_WBS where UID="+UID; //string order_Num = WebModel.SItemName(dbname, SelectOrder_Num, "order_Num"); //string SQLUpperUID = "Select UpperUID from Bid_WBS where UID=" + UID; //string UpperUID = WebModel.SItemName(dbname, SQLUpperUID, "UpperUID"); string SQLSearchUID = "Select UID from Bid_WBS where UID=" + UpperUID; string SearchUID = WebModel.SItemName(dbname, SQLSearchUID, "UID"); if (SearchUID == "") { result = SortNum; } else { string SQLSrarchorder_Num = "Select order_Num from Bid_WBS where UID=" + SearchUID; string Srarchorder_Num = WebModel.SItemName(dbname, SQLSrarchorder_Num, "order_Num"); result = Srarchorder_Num; } return(result); }
protected void LoadContent() { if (Session["ProjectCode"] != null) { string database = Session["DatabaseName"].ToString(); string SQLString = "Select * from Pro_Resource where PriceID='" + Session["PriceID"].ToString() + "'"; DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { //Session["bid"] = row["Bid"].ToString(); TxRSName.Text = row["ItemName"].ToString(); TxCode1.Text = row["Code"].ToString(); DDL_EdUnit.SelectedValue = (row["Unit"].ToString() != "") ? row["Unit"].ToString().Trim() : "M"; //Add_anl.Visible = (row["Complex"].ToString() != "1") ? true : false; DDL_RsKind1.SelectedValue = row["ItemKind"].ToString() != ""?row["ItemKind"].ToString():"0"; TxNote.Text = row["Notes"].ToString(); } DataTableBox.Dispose(); //釋放Table資源 } } }
protected void LoadContent() { string database = Session["DatabaseName"].ToString(); string SQLStringNum = "Select MAX(LayerNum) as id from Bid_WBS where BID=" + Session["BID"] + ""; //string SQLString1 = ""; //if (Session["thisID"] != null) //{ // SQLString1 = "Select * from Bid_Library where PriceID=" + Session["thisID"].ToString() + ""; //} DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLStringNum); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { LbLayerNum = row["id"].ToString(); } if (ViewState["addLayer"] == null) { LbLayerNum = LbLayerNum != "" ? LbLayerNum : "1"; for (int i = 1; i <= int.Parse(LbLayerNum); i++) { DDLLayer.Items.Add(new ListItem(i.ToString(), i.ToString())); } } } ViewState["addLayer"] = true; if (Session["EItemName"] != null) { TxItemName.Text = Session["EItemName"].ToString(); } }
protected void LoadContent() { string database = Session["DatabaseName"].ToString(); string SQLSelect = "Select * from EBudget_WBS a left join Pro_Resource b on a.PriceID=b.PriceID where a.EWID=" + EWID; DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLSelect); LbEdition.Text = (WebModel.MaxAnyID(database, "EBudget_Change", Session["ProjectCode"].ToString(), "EEdition")).ToString(); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { //LbEdition.Text = row["CEdition"].ToString(); LbItemName.Text = row["ItemName"].ToString(); LbUnit.Text = row["Unit"].ToString(); LbItemOrder.Text = row["ItemOrder"].ToString(); LbNotes.Text = row["Notes"].ToString(); string upperwid = row["UpperWID"].ToString(); string SelectItemName = "Select * from EBudget_WBS where EWID=" + upperwid; string PriceID = row["PriceID"].ToString(); LbUpItem.Text = WebModel.SItemName(database, SelectItemName, "ItemName"); LbEQuantity.Text = row["LastENumber"].ToString() != "" ? row["LastENumber"].ToString() : "0"; LbEPrice.Text = row["EPrice"].ToString() != "" ? decimal.Parse(row["EPrice"].ToString()).ToString("N0") : "0"; LbEComplex.Text = (decimal.Parse(LbEQuantity.Text) * decimal.Parse(LbEPrice.Text)).ToString("N0"); } } }
protected void add_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); string ErrorString = ""; string _TableNameadd = "Bid_Joint"; //檢查標題文字 ErrorString += (TxJBItem.Text) == string.Empty ? "共同投標項目請填入!!\\n" : ""; ErrorString += (TxJBPrice.Text) == string.Empty ? "共同投標金額請填入!!\\n" : ""; //確認是否全選 if (ErrorString == "") { //確認選項是否存在或過期 if (Session["bid"] == null) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { WebModel.SaveAction_BID(database, _TableNameadd, GetDataBox_add()); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔完成');", true); GridView1.DataBind(); TxJBItem.Text = ""; TxJBPrice.Text = ""; } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } }
//儲存資料 protected void SaveAction(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); //檢查標題文字 ErrorString += (StageName.Text) == string.Empty ? "階段名稱請填入!!\\n" : ""; ErrorString += (DurationType.SelectedIndex) == -1 ? "工期方式請選擇!!\\n" : ""; ErrorString += (Duration.Text) == string.Empty ? "開工期限天數請填入!!\\n" : ""; ErrorString += (PunishType.SelectedIndex) == -1 ? "完工提報期限請填入!!\\n" : ""; ErrorString += (Punish.Text) == string.Empty ? "工期延展請填入!!\\n" : ""; ErrorString += (Notes.Text) == string.Empty ? "工期延展請填入!!\\n" : ""; //確認是否全選 if (ErrorString == "") { //確認選項是否存在或過期 if (Session["ProjectCode"] == null) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { WebModel.EditAction_pro(database, _TableName, Session["ProjectCode"].ToString(), GetDataBox()); 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('" + ErrorString + "');", true); } }
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); }
protected void ImgExcel_Click(object sender, ImageClickEventArgs e) { string ProjectName = WebModel.PidName(Session["DatabaseName"].ToString(), "ProjectM0", Session["ProjectCode"].ToString()); Response.Expires = 0; Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + ProjectName + ".xls"); Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>"); string l_str2 = ""; l_str2 += @"<table border=""1"" class=""Table1""><tr class=""TableTop"">"; l_str2 += Literal1.Text; l_str2 += Literal4.Text; l_str2 += Literal2.Text; l_str2 += Literal5.Text; l_str2 += @"<tr class=""TableSingle"">"; l_str2 += Literal3.Text; l_str2 += @"</tr></table>"; Response.Write(l_str2); Response.End(); }
protected void Recovery_Click(object sender, EventArgs e) { if ((Session["UserName"] == null) || (Session["CompanyName"] == null || Session["ProjectCode"] == null)) { Response.Redirect("Login.aspx"); } else { string database = Session["DatabaseName"].ToString(); DataTable DataTableBox = WebModel.LoadContentData_pro(database, _TableName, Session["ProjectCode"].ToString(), SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { // DataTableDr["bid"] = Session["bid"].ToString(); Session["ProjectCode"] = row["pid"].ToString(); ContractCaution1.Text = row["ContractCaution1"].ToString(); ContractCaution2.Text = row["ContractCaution2"].ToString(); ContractCaution3.Text = row["ContractCaution3"].ToString(); ContractCaution4.Text = row["ContractCaution4"].ToString(); } DataTableBox.Dispose(); //釋放Table資源 } } }
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"]; } }
public bool datacheck(string data) { string database = Session["DatabaseName"].ToString(); if (Session["Bid"] == null) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { // string SQLString = "bid,EngCountry,EngLocation,EGetBidNY,EBiddingNY,BiddingEndDate,OwnerName,OwnerContactPerson,OwnerAddress,OwnerContactTel,IlluBond,PerformanceBondType,PerformanceBond," + //"IlluFee,ReturnIlluDeadline,BidBondType,BidBond,GetBidAddress,GetBidNY,OpenBidTime,FirmQualif,JointBidNY,AwardingType,OpenBidAddress"; //DataTable WebModel =new DataTable; DataTable DataTableBox = WebModel.LoadContentData_bid(database, _TableName, Session["Bid"].ToString(), SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { return(true); } else { return(false); } } return(false); }
protected void Add_Click(object sender, EventArgs e) { string UpdateItemOrder = ""; string database = Session["DatabaseName"].ToString(); string datatable = "EBudget_WBS"; ErrorString += (DDLLayer.SelectedValue) == "0" ? "請輸入階層!!\\n" : ""; ErrorString += (DDLKind.SelectedValue) == "0" ? "請輸入工項類型!!\\n" : ""; //ErrorString += (DDLTop.SelectedValue) == "0" ? "請輸入上層工項!!\\n" : ""; ErrorString += (TxItemName.Text) == string.Empty ? "請輸入名稱!!\\n" : ""; //確認是否全選 if (ErrorString == "") { string select = "Select * from ProjectM0 where pid=" + Session["ProjectCode"].ToString(); string BidNumType = WebModel.SItemName(database, select, "CBudgetNumType"); //if (BidNumType != "") //{ string result1 = WebModel.SaveAction(database, datatable, GetDataBox()); //LayerCodeSort.Sort_LayerCode(database, Session["ProjectCode"].ToString()); bool result = DAL.LayerCodeSort.Update_order_num(Session["DatabaseName"].ToString(), Session["ProjectCode"].ToString()); //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode();", true);//ajax 新增階層碼 //if (BidNumType == "0") //{ bool result2 = DAL.LayerCodeSort.Update_order_num(Session["DatabaseName"].ToString(), Session["ProjectCode"].ToString()); UpdateItemOrder = "update EBudget_WBS set EBudget_WBS.ItemOrder = OrderName from Bid_WBSLayer join EBudget_WBS on EBudget_WBS.LayerNum=Bid_WBSLayer.LayerNum join LayerOrder on EBudget_WBS.SortNum = LayerOrder.OrderNum and Bid_WBSLayer.LayerKind = LayerOrder.Kind where Bid_WBSLayer.PID=0"; WebModel.SQLAction(database, UpdateItemOrder); //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode();", true);//ajax 新增階層碼 //} //else if (BidNumType == "1") //{ // bool result2 = DAL.LayerCodeSort.Update_order_num(Session["DatabaseName"].ToString(), Session["ProjectCode"].ToString()); // //UpdateItemOrder = "update Bid_WBS set Bid_WBS.ItemOrder = LayerOrder.OrderName from Bid_WBSLayer join BID_WBS on BID_WBS.LayerNum=Bid_WBSLayer.LayerNum join LayerOrder on Bid_WBS.SortNum = LayerOrder.OrderNum and Bid_WBSLayer.LayerKind = LayerOrder.Kind where Bid_WBSLayer.BID=" + Session["ProjectCode"].ToString() + ""; // //bool result4 = WebModel.SQLAction(database, UpdateItemOrder); // Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode1();", true);//ajax 新增階層碼 //} ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 已新增連結');", true); //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode();", true); //} //else //{ // ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請先至合約預算建置編修,設定階層及編號!!!');", true); //} Response.Write("<script>window.opener.document.getElementById('ContentPlaceHolder1_LinkButton1').click();</script>"); TxItemName.Text = ""; DDLLayer.SelectedValue = "0"; DDLTop.SelectedValue = "0"; DDLKind.SelectedValue = "0"; TxNotes.Text = ""; //ItemName.Text = ""; } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } }
//儲存資料 protected void SaveAction(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); //檢查標題文字 ErrorString += (TxProjectCode1.Text) == string.Empty ? "專案(工程)編號請填入!!\\n" : ""; ErrorString += (TxProjectName1.Text) == string.Empty ? "專案(工程)名稱請填入!!\\n" : ""; //ErrorString += (TxProjectNickname1.Text) == string.Empty ? "專案(工程)簡稱請填入!!\\n" : ""; //確認是否全選 if (ErrorString == "") { string result = WebModel.SaveAction_pro(database, _TableName, GetDataBox(), Session["ProjectCode"].ToString()); if (result != "0") { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔完成');", true); TxProjectCode1.Text = ""; TxProjectName1.Text = ""; TxProjectNickname1.Text = ""; TxNote1.Text = ""; } else { 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('" + ErrorString + "');", true); } }
protected void Recovery_Click(object sender, EventArgs e) { if ((Session["UserName"] == null) || (Session["CompanyName"] == null || Session["ProjectCode"] == null)) { Response.Redirect("Login.aspx"); } else { string database = Session["DatabaseName"].ToString(); DataTable DataTableBox = WebModel.LoadContentData_pro(database, _TableName, Session["ProjectCode"].ToString(), SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { // DataTableDr["bid"] = Session["bid"].ToString(); Session["ProjectCode"] = row["pid"].ToString(); PriceSubsidyNY.SelectedValue = row["PriceSubsidyNY"].ToString(); PrepayPercentage.Text = row["PrepayPercentage"].ToString(); EstAcceptNum.Text = row["EstAcceptNum"].ToString(); EstAcceptUnit.Text = row["EstAcceptUnit"].ToString(); EstAcceptDate1.Text = row["EstAcceptDate1"].ToString(); EstAcceptDate2.Text = row["EstAcceptDate2"].ToString(); RetentionPercentage.Text = row["RetentionPercentage"].ToString(); OtherPayment.Text = row["OtherPayment"].ToString(); } DataTableBox.Dispose(); //釋放Table資源 } } }
//讀取資料 protected void LoadData() { if (Session["DatabaseName"] == null && Session["bid"] == null) { Response.Redirect("../login.aspx"); } string SQLString = "Select * from BidM0 a Left join BidAssess e on a.bid=e.bid where a.bid ='" + Session["bid"].ToString() + "'"; string database = Session["DatabaseName"].ToString(); DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { Session["bid"] = row["bid"].ToString(); LbCondition1.Text = row["Condition1"].ToString(); LbConditionNote1.Text = row["ConditionNote1"].ToString(); LbCondition2.Text = row["Condition2"].ToString(); LbConditionNote2.Text = row["ConditionNote2"].ToString(); LbCondition3.Text = row["Condition3"].ToString(); LbConditionNote3.Text = row["ConditionNote3"].ToString(); LbCondition4.Text = row["Condition4"].ToString(); LbConditionNote4.Text = row["ConditionNote4"].ToString(); LbCondition5.Text = row["Condition5"].ToString(); LbConditionNote5.Text = row["ConditionNote5"].ToString(); LbCondition6.Text = row["Condition6"].ToString(); LbConditionNote6.Text = row["ConditionNote6"].ToString(); } } DataTableBox.Dispose(); //釋放Table資源 }
protected void LoadContent() { if ((Session["UserName"] == null) || (Session["CompanyName"] == null || Session["ProjectCode"] == null)) { Response.Redirect("Login.aspx"); } else { string database = Session["DatabaseName"].ToString(); string _TableName = "ProjectM2"; string SQLString = "Pid,StartDeadlinetype,StartDeadline,CompletionEscDeadline,DelayEscDeadline"; DataTable DataTableBox = WebModel.LoadContentData_pro(database, _TableName, Session["ProjectCode"].ToString(), SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { StartDeadlinetype.Text = (row["StartDeadlinetype"].ToString()) == "0" ? "業主通知後" : (row["StartDeadlinetype"].ToString()) == "1" ? "建照取得後": (row["StartDeadlinetype"].ToString()) == "2" ? "西元(YYYY/MM/DD)" : (row["StartDeadlinetype"].ToString()) == "3" ? "合約簽訂後":""; StartDeadline.Text = row["StartDeadline"].ToString(); CompletionEscDeadline.Text = row["CompletionEscDeadline"].ToString(); DelayEscDeadline.Text = row["DelayEscDeadline"].ToString(); } DataTableBox.Dispose(); //釋放Table資源 } } }
protected void Recovery_Click(object sender, EventArgs e) { if ((Session["UserName"] == null) || (Session["CompanyName"] == null || Session["ProjectCode"] == null)) { Response.Redirect("Login.aspx"); } else { string database = Session["DatabaseName"].ToString(); DataTable DataTableBox = WebModel.LoadContentData_pro(database, _TableName, Session["ProjectCode"].ToString(), SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { // DataTableDr["bid"] = Session["bid"].ToString(); Session["ProjectCode"] = row["pid"].ToString(); DurationType.SelectedIndex = int.Parse(row["DurationType"].ToString()); StageName.Text = row["StageName"].ToString(); Duration.Text = row["Duration"].ToString(); PunishType.SelectedIndex = int.Parse(row["PunishType"].ToString()); Punish.Text = row["Punish"].ToString(); Notes.Text = row["Notes"].ToString(); } DataTableBox.Dispose(); //釋放Table資源 } } }
protected void LoadContent() { if (Session["PriceID"] != null) { string database = Session["DatabaseName"].ToString(); string SQLString = "Select * from Bid_Library where PriceID='" + Session["PriceID"].ToString() + "'"; string SQLString1 = "Select * from Bid_Library a left join Bid_AnaRelation b on a.PriceID=b.KidID where b.ParentID='" + Session["PriceID"].ToString() + "' and a.bid=" + Session["bid"].ToString(); DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQLString1); DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString); DataTableBox1.Columns.Add("Kind"); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { LbItemName.Text = row["ItemName"].ToString(); LbUnit.Text = row["Unit"].ToString(); LbCode.Text = row["Code"].ToString(); TxAnaNumber.Text = row["AnaNumber"].ToString(); } //DataTableBox.Dispose(); //釋放Table資源 } if (DataTableBox1 != null && DataTableBox1.Rows.Count > 0) { GridView2.DataSource = DataTableBox1; GridView2.DataBind(); Session["DataTable"] = DataTableBox1; } } }
protected DataTable GetDataBox() { string database = Session["DatabaseName"].ToString(); string SQLSelect = "Select CEdition from CBudget_Change where EEdition=" + LbEdition.Text; string CBVersion = WebModel.SItemName(database, SQLSelect, "CEdition"); DataTable DataTableBox = new DataTable(); string SQLDetail = "PID,EWID,ChNumber" + LbEdition.Text + ",Response" + LbEdition.Text + ",Reason" + LbEdition.Text + ",CBudget" + LbEdition.Text + ""; foreach (string DataName in SQLDetail.Split(',')) { DataTableBox.Columns.Add(DataName, typeof(string)); } DataRow DTDr = DataTableBox.NewRow(); if (Session["ProjectCode"] != null) { DTDr["PID"] = Session["ProjectCode"].ToString(); DTDr["EWID"] = EWID; DTDr["ChNumber" + LbEdition.Text + ""] = decimal.Parse(TxACQuantity.Text); DTDr["CBudget" + LbEdition.Text + ""] = CBVersion; DataTableBox.Rows.Add(DTDr); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } return(DataTableBox); }
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { if (Session["DatabaseName"] == null) { Response.Redirect("../login.aspx"); } string database = Session["DatabaseName"].ToString(); if (RadioButtonList1.SelectedItem != null) { string com = RadioButtonList1.SelectedItem.Value; string SQLString = "uid,Name,Type,Owner,OwnerMobile,EIN,TEL1,TEL2,Fax1,Fax2,Capital,StaffAmount,RegisteredAddress,ContectAddress," + "(select capital from FirmAssess where uid =" + com + ") as capital1," + "(select staff from FirmAssess where uid =" + com + ") as staff," + "(select profession from FirmAssess where uid =" + com + ") as profession," + "(select equipment from FirmAssess where uid =" + com + ") as equipment," + "(select quality from FirmAssess where uid =" + com + ") as quality," + "(select quotation from FirmAssess where uid =" + com + ") as quotation," + "(select score from FirmAssess where uid =" + com + ") as score," + "(select result from FirmAssess where uid =" + com + ") as result," + "(select Assessor from FirmAssess where uid =" + com + ") as Assessor," + "(select explanation from FirmAssess where uid =" + com + ") as explanation"; DataTable DataTableBox = WebModel.LoadContentData(database, "FirmM", com, SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { Rep_company.DataSource = DataTableBox; Rep_company.DataBind(); } } }
protected void BtnSave_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); string ErrorString = ""; ErrorString += (TxIDQuantity.Text) == "" || (TxIDQuantity.Text) == "0" ? "請輸入本次追加減金額!!\\n" : ""; if (ErrorString == "") { if (datacheck() == false) { WebModel.SaveAction(database, "EBudget_Change_Detail", GetDataBox()); WebModel.EditAction_Anyid(database, "EBudget_WBS", EWID, "EWID", GetDataBox1()); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('儲存成功');", true); } else { WebModel.EditAction_Anyid(database, "EBudget_Change_Detail", UId, "UID", GetDataBox()); //WebModel.EditAction(database, "CBudget_Change_Detail",UId, GetDataBox()); WebModel.EditAction_Anyid(database, "EBudget_WBS", EWID, "EWID", GetDataBox1()); 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('" + ErrorString + "');", true); } }
protected void ImgExcel_Click(object sender, ImageClickEventArgs e) { string ProjectName = WebModel.PidName(Session["DatabaseName"].ToString(), "ProjectM0", Session["ProjectCode"].ToString()); Response.Expires = 0; Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + ProjectName + ".xls"); Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>"); string l_str2 = ""; l_str2 += @"<table class=""Table100"" border=""1""> <tr><td class=""Table0C"" colspan=""6"">分包預算工料</td>"; l_str2 += DateListString.Text; l_str2 += @"</tr> <tr> <td class=""Table0C"">項次</td> <td class=""Table0C"">工項/工料名稱</td> <td class=""Table0C"">單位</td> <td class=""Table0C"">分包數量</td> <td class=""Table0C"">預算單價</td> <td class=""Table0C"">預算複價</td>"; l_str2 += DateListString1.Text; l_str2 += DateListString2.Text; l_str2 += DateListString3.Text; l_str2 += @"</tr></table>"; Response.Write(l_str2); Response.End(); }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { string database = Session["DatabaseName"].ToString(); string SQLSelect = "Select * from ProjectM0 where Pid=" + Session["ProjectCode"].ToString(); string Lock = WebModel.SItemName(database, SQLSelect, "SProgressLock"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRow vsDr = (DataRow)((DataRowView)e.Item.DataItem).Row; Label LbItemName = (Label)e.Item.FindControl("LbItemName"); ImageButton IBtn_A1 = (ImageButton)e.Item.FindControl("IBtn_A1"); ImageButton IBtn_D1 = (ImageButton)e.Item.FindControl("IBtn_D1"); TextBox TB_N1 = (TextBox)e.Item.FindControl("TB_N1"); TextBox TB_P1 = (TextBox)e.Item.FindControl("TB_P1"); TB_N1.Text = LbItemName.Text; if (Lock == "1") { IBtn_A1.Visible = false; IBtn_D1.Visible = false; TB_P1.Enabled = false; TB_N1.Enabled = false; } else { IBtn_A1.Visible = true; IBtn_D1.Visible = true; TB_P1.Enabled = true; TB_N1.Enabled = true; } } }
protected void BtnAdd_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); string _TableName = "EBudget_Change"; string UdCBudget = "Update CBudget_Change set EEdition=" + Eedittion + " where CEdition=" + DropDownList1.SelectedValue; string SQLEBLock = "Select * from ProjectM0 where PID=" + Session["ProjectCode"].ToString(); string EBLock = WebModel.SItemName(database, SQLEBLock, "EBudgetLock"); //確認選項是否存在或過期 if (Session["ProjectCode"] == null) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else if (EBLock != "1") { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 執行預算尚未鎖定,請鎖定後再變更!!');", true); } else { WebModel.SaveAction(database, _TableName, GetDataBox()); WebModel.SQLAction(database, UdCBudget); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔完成');", true); Response.Write("<script>self.close()</script>"); } }
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 = ""; } }
public bool datacheck_TempSave(string data) { string database = Session["DatabaseName"].ToString(); if (Session["Bid"] == null) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { DataTable DataTableBox = WebModel.LoadContentData_bid(database, _TableName, Session["Bid"].ToString(), SQLString); int s = -1; string p = ""; if (DataTableBox != null && DataTableBox.Rows.Count > 0) { foreach (DataRow row in DataTableBox.Rows) { // DataTableDr["bid"] = Session["bid"].ToString(); Session["Bid"] = row["BID"].ToString(); s = int.Parse(row["PreSuggestion"].ToString()); p = row["PreResultNote"].ToString(); } if (s != -1 || p != "") { return(true); } else { return(false); } } } return(false); }
protected void EdDelete_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); string SQLString = "Select * from Pro_Analysis where KidID='" + Session["PriceID"].ToString() + "'"; string SQLString1 = "Select * from EBudget_WBS where PriceID='" + Session["PriceID"].ToString() + "'"; DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString); DataTable DataTableBox1 = WebModel.LoadSetContentData(database, SQLString1); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('有下層單價分析,不能刪除');", true); } else if (DataTableBox1 != null && DataTableBox1.Rows.Count > 0) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('本工料為工項引用,不能刪除');", true); } else { string Sql = "Delete " + _TableName + " where PriceID=" + Session["PriceID"] + ""; string Delanalyst = "Delete Pro_Analysis where ParentID=" + Session["PriceID"] + ""; WebModel.SQLAction(database, Sql); WebModel.SQLAction(database, Delanalyst); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('已刪除完成');", true); } GridView1.DataBind(); TxRSName.Text = ""; TxCode1.Text = ""; TxNote.Text = ""; }
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; } } }
protected void Btn_Allsave_Click(object sender, EventArgs e) { int Mv_times = LB_Private.Items.Count; string database = Session["DatabaseName"].ToString(); bool result = false; for (int i = Mv_times - 1; i >= 0; i--) { ListItem LI = new ListItem(); LI.Text = LB_Private.Items[i].Text; LI.Value = LB_Private.Items[i].Value; string Content = LI.Text.Split('-')[1]; string ID = LI.Value.Split('|')[0]; string Type = LI.Value.Split('|')[1].Trim(); string Sortnumber = LI.Value.Split('|')[2]; string UnitID = LI.Value.Split('|')[3]; //string clound = LI.Value.Split('|')[4]; if (DAL.WordLibrary.checkPublicID(database, ID)) { string Insert = "insert into [UsualWord] ([Type],[Content],[Sortnumber],[UnitID],[PublicID]) VALUES('" + Type + "','" + Content + "','" + Sortnumber + "','" + UnitID + "','" + ID + "')"; result = WebModel.SQLAction(Session["DatabaseName"].ToString(), Insert); //NextID = WebModel.MaxID(database, "PrivateResource") - 1; } } if (result) { Response.Write("<script>alert('新增成功');</script>"); } else { Response.Write("<script>alert('新增失敗');</script>"); } }
public bool datacheck(string data) { string database = Session["DatabaseName"].ToString(); if (DropDownList1.SelectedValue == "") { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { string SQLString = "Select * from Firm_Assess where FirmID=" + DropDownList1.SelectedValue; //DataTable WebModel =new DataTable; DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLString); if (DataTableBox != null && DataTableBox.Rows.Count > 0) { return(true); } else { return(false); } } return(false); }