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 BtnSave_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); string ErrorString = ""; string _TableName = "Firm_Check"; //檢查標題文字 ErrorString += (RadioButtonList1.SelectedItem) == null ? "資本額請填入評分!!\\n" : ""; ErrorString += (RadioButtonList2.SelectedItem) == null ? "員工數請填入評分!!\\n" : ""; ErrorString += (RadioButtonList3.SelectedItem) == null ? "專業能力請填入評分!!\\n" : ""; ErrorString += (RadioButtonList4.SelectedItem) == null ? "設備(施工/工廠)請填入評分!!\\n" : ""; ErrorString += (RadioButtonList5.SelectedItem) == null ? "品管措施請填入評分!!\\n" : ""; ErrorString += (RadioButtonList6.SelectedItem) == null ? "報價請填入評分!!\\n" : ""; //確認是否全選 if (ErrorString == "") { //確認選項是否存在或過期 if (DDL_SCID.SelectedValue == "") { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { //確認資料庫是否有資料 if (datacheck(DDL_SCID.SelectedValue) == false) { string result1 = WebModel.SaveAction(database, _TableName, GetDataBox()); if (result1 == "1") { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔完成');", true); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔失敗');", true); } } else { bool result = WebModel.EditAction_Anyid(database, _TableName, DDL_SCID.SelectedValue, "SCID", GetDataBox()); //Response.Write if (result) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('修改完成');", true); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔失敗');", true); } } } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } }
protected void BtnSave_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); bool result = WebModel.EditAction_Anyid(database, "EBudget_Change", "UID", ID, GetDataBox()); if (result) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔完成');", true); Response.Write("<script> window.close();</script>"); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔失敗');", true); } }
protected void BtnSaveEdit_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); bool Result = WebModel.EditAction_Anyid(database, "FirmM", UID1.Text, "UID", GetDataBox1()); if (Result) { Response.Write("<script>alert('存檔成功');</script>"); } else { Response.Write("<script>alert('存檔失敗');</script>"); } GridView4.DataBind(); }
//儲存資料 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["bid"] == null) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 請重新選擇');", true); } else { //確認資料庫是否有資料 //if (datacheck(Session["Bid"].ToString()) == false) //{ //WebModel.SaveAction_BID(database, _TableName, GetDataBox()); //ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('存檔完成');", true); //} //else //{ WebModel.EditAction_Anyid(database, _TableName, "PunishID", PunishID, GetDataBox()); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('修改完成');", true); Response.Write("<script>window.opener.document.getElementById('callback').click();</script>"); //} } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } }
protected void SaveWBS_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); bool result = false; bool result1 = false; bool result2 = false; string result3 = ""; bool delfalg = false; decimal TotalPrice = 0; string SQLString = "PriceID,Bid,ItemKind,ItemName,Unit,Complex,Code,Notes"; DataTable DataTableBox = new DataTable(); DataRow DataTableDr = DataTableBox.NewRow(); foreach (string DataName in SQLString.Split(',')) { DataTableBox.Columns.Add(DataName, typeof(string)); } //後台功能,必需要有的欄位名稱 #region 內容設定 foreach (GridViewRow row in GridView2.Rows) { Label PriceID = (Label)row.FindControl("PriceID"); TextBox TxSort = (TextBox)row.FindControl("TxSort"); DropDownList ItemKind = (DropDownList)row.FindControl("ItemKind"); TextBox ItemName = (TextBox)row.FindControl("ItemName"); DropDownList DDL_EdUnit = (DropDownList)row.FindControl("DDL_EdUnit"); ImageButton Complex = (ImageButton)row.FindControl("Complex"); TextBox Code = (TextBox)row.FindControl("Code"); TextBox Quantity = (TextBox)row.FindControl("Quantity"); TextBox Notes = (TextBox)row.FindControl("Notes"); Label Price = (Label)row.FindControl("Price"); Label Kind = (Label)row.FindControl("Kind"); //if (datacheck(ItemName.Text, DDL_EdUnit.SelectedValue) == false) //{ if (Quantity.Text != "" && Price.Text != "") { TotalPrice += decimal.Parse(Quantity.Text) * decimal.Parse(Price.Text); } DataTableBox.Rows.Clear(); if (DataTableBox.Rows.Count != 0 || ItemName.Text != "") { DataTableDr["PriceID"] = PriceID.Text; DataTableDr["Bid"] = Session["Bid"].ToString(); DataTableDr["ItemKind"] = ItemKind.SelectedItem.Text; DataTableDr["ItemName"] = ItemName.Text; DataTableDr["Unit"] = DDL_EdUnit.SelectedValue; DataTableDr["Complex"] = (Complex.Visible == true) ? "1" : (Complex.Visible == false) ? "2" : "0"; DataTableDr["Code"] = Code.Text; //DataTableDr["Number"] = Quantity.Text; DataTableDr["Notes"] = Notes.Text; DataTableBox.Rows.Add(DataTableDr); #endregion if (TxSort.Text != "" && ItemName.Text != "" && Quantity.Text != "") { //string SQLString1 = "Select * from Bid_AnaRelation where KidID=" + PriceID.Text + " and ParentID="+ Session["PriceID"].ToString() +""; if (!delfalg) { string SQLString2 = "Delete from Bid_AnaRelation where ParentID=" + Session["PriceID"].ToString() + ""; result = WebModel.SQLAction(database, SQLString2); delfalg = true; } //更新父項內容 //string addImport = Code.Text.Split('ξ')[1]; //Regex reg = new Regex("ξ"); //Match m = reg.Match(Code.Text); //var isContain = Regex.Match("HELLO,IamAString", "string", RegexOptions.IgnoreCase).Success; //if (m.Success) if (Kind.Text == "0") { DataTableBox.Columns.Remove("PriceID"); //DataTableDr["Bid"] = Session["Bid"].ToString(); result3 = WebModel.SaveAction(database, "Bid_Library", DataTableBox); DataTableBox.Columns.Add("PriceID"); } else { result2 = WebModel.EditAction_Anyid(database, _TableName, PriceID.Text, "PriceID", DataTableBox); } if (Session["PriceID"].ToString() != PriceID.Text) { if (Kind.Text == "0") { int sid = WebModel.MaxID(database, "Bid_Library") - 1; string Sql2 = "insert into Bid_AnaRelation ([SortNum],[ParentID],[KidID],[Number]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + sid + "','" + Quantity.Text + "')"; result1 = WebModel.SQLAction(database, Sql2); } else if (Kind.Text == "1") { string Sql2 = "insert into Bid_AnaRelation ([SortNum],[ParentID],[KidID],[Number]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + PriceID.Text + "','" + Quantity.Text + "')"; result1 = WebModel.SQLAction(database, Sql2); } else { string Sql2 = "insert into Bid_AnaRelation ([SortNum],[ParentID],[KidID],[Number]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + PriceID.Text + "','" + Quantity.Text + "')"; result1 = WebModel.SQLAction(database, Sql2); } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請輸入工項各項內容');", true); } if (result1) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('工項已全儲存完畢');", true); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('工項儲存失敗');", true); } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請輸入工項');", true); } } } //更新父項單價 decimal Price1 = TotalPrice / decimal.Parse(TxAnaNumber.Text); string Sql3 = "update " + _TableName + " set Complex=1,Price='" + Price1 + "' where PriceID= '" + Session["PriceID"].ToString() + "'"; bool result4 = WebModel.SQLAction(database, Sql3); // ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('("+ItemName.Text+")已有相同名稱');", true); //} }
protected void BtnRequire_Click(object sender, EventArgs e) { string ErrorString = ""; string insert = ""; string insert1 = ""; string ReplyDate = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxRFQ_ReplyDate.Text)); string Warranty = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxRFQ_Warranty.Text)); string Notes = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxRFQ_Notes.Text)); string database = Session["DatabaseName"].ToString(); //檢查標題文字 ErrorString += (ReplyDate) == string.Empty ? "報價回覆期限請填入!!\\n" : ""; //確認是否全選 if (ErrorString == "") { string SQLInsertMaterial = "SBID,FirmID,SB_MID,PriceID,Explan,Note"; string SQLStringFirm = "SBID,Sort,FirmID,ExpiretionDate"; string SQLUdSubBudgetList = "SBID,RFQ_ReplyDate,RFQ_Warranty,RFQ_Attach1,RFQ_Attach2,RFQ_Attach3,RFQ_Attach4,RFQ_Attach5,RFQ_Attach6,RFQ_AttachOther,RFQ_Notes"; DataTable DataTableBoxM = new DataTable(); DataTable DataTableBoxF = new DataTable(); DataTable DataTableBoxS = new DataTable(); foreach (string DataName in SQLInsertMaterial.Split(',')) { DataTableBoxM.Columns.Add(DataName, typeof(string)); } foreach (string DataName in SQLStringFirm.Split(',')) { DataTableBoxF.Columns.Add(DataName, typeof(string)); } foreach (string DataName in SQLUdSubBudgetList.Split(',')) { DataTableBoxS.Columns.Add(DataName, typeof(string)); } DataRow DataTableDrS = DataTableBoxS.NewRow(); DataTableDrS["SBID"] = LbSBID.Text; DataTableDrS["RFQ_ReplyDate"] = TxRFQ_ReplyDate.Text; DataTableDrS["RFQ_Warranty"] = TxRFQ_Warranty.Text != ""?decimal.Parse(TxRFQ_Warranty.Text):0; DataTableDrS["RFQ_Attach1"] = CheckBox1.Checked ? true : false; DataTableDrS["RFQ_Attach2"] = CheckBox2.Checked ? true : false; DataTableDrS["RFQ_Attach3"] = CheckBox3.Checked ? true : false; DataTableDrS["RFQ_Attach4"] = CheckBox4.Checked ? true : false; DataTableDrS["RFQ_Attach5"] = CheckBox5.Checked ? true : false; DataTableDrS["RFQ_Attach6"] = CheckBox6.Checked ? true : false; DataTableDrS["RFQ_AttachOther"] = TextBox6.Text; DataTableDrS["RFQ_Notes"] = TxRFQ_Notes.Text; DataTableBoxS.Rows.Add(DataTableDrS); bool j = WebModel.EditAction_Anyid(database, "SubBudgetList", "SBID", LbSBID.Text, DataTableBoxS); int i = 1; foreach (GridViewRow row in GridView4.Rows) { CheckBox CheckBoxSF = (CheckBox)row.FindControl("CheckBoxSF"); Label UID = (Label)row.FindControl("UID"); DataRow DataTableDr1 = DataTableBoxF.NewRow(); if (CheckBoxSF.Checked == true) { DataTableDr1["Sort"] = i; DataTableDr1["SBID"] = LbSBID.Text; DataTableDr1["FirmID"] = UID.Text; DataTableDr1["ExpiretionDate"] = TxRFQ_ReplyDate.Text; //DataTableDr1["Notes"] = TxRFQ_Notes.Text; DataTableBoxF.Rows.Add(DataTableDr1); insert1 = WebModel.SaveAction(database, "SubRFQ_Firm", DataTableBoxF); DataTableBoxF.Rows.Clear(); i++; foreach (RepeaterItem item in Repeater1.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { Label LbSB_MID = (Label)item.FindControl("LbSB_MID") as Label; Label LbBPrice = (Label)item.FindControl("LbBPrice") as Label; Label LbItemName = (Label)item.FindControl("LbItemName") as Label; Label LbUnit = (Label)item.FindControl("LbUnit") as Label; Label LbQuantity = (Label)item.FindControl("LbQuantity") as Label; Label LbBComplex = (Label)item.FindControl("LbBComplex") as Label; DataRow DataTableDr = DataTableBoxM.NewRow(); //foreach (GridViewRow row in GridView4.Rows) //{ // // CheckBox CheckBox3 = (CheckBox)row.FindControl("CheckBox3"); // Label UID = (Label)row.FindControl("UID"); //if (CheckBox3.Checked == true) //{ DataTableDr["SBID"] = LbSBID.Text; DataTableDr["SB_MID"] = LbSB_MID.Text; //DataTableDr["UnitPrice"] = ""; DataTableDr["FirmID"] = UID.Text; //DataTableDr["ComplexPrice"] = ""; DataTableDr["Note"] = TxRFQ_Notes.Text; DataTableBoxM.Rows.Add(DataTableDr); insert = WebModel.SaveAction(database, "SubRFQ_Material", DataTableBoxM); DataTableBoxM.Rows.Clear(); //} //string SQLLibrary = "Update Bid_Library Set RFQ_Code='" + RFQ_Code + "' where PriceID= " + LbPrice.Text + ""; //WebModel.SQLAction(database, SQLLibrary); } } } } if (insert != "1" && insert1 != "1" && j != true) { Response.Write("<script>alert('資料庫更新失敗');</script>"); } else { Response.Write("<script>alert('存檔成功');</script>"); } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } }
protected void SaveWBS_Click(object sender, EventArgs e) { string database = Session["DatabaseName"].ToString(); bool result = false; bool result1 = false; bool result2 = false; bool result4 = false; string result3 = ""; bool delfalg = false; //string SQLString = "PriceID,SortNum,Kind,ItemName,Unit,Complex,Code,WorkRate,Notes"; string SQLString = "Pid,PriceID,ItemKind,ItemName,Unit,Complex,Code,AnaNumber,Notes"; DataTable DataTableBox = new DataTable(); foreach (string DataName in SQLString.Split(',')) { DataTableBox.Columns.Add(DataName, typeof(string)); } //後台功能,必需要有的欄位名稱 #region 內容設定 foreach (GridViewRow row in GridView2.Rows) { Label PriceID = (Label)row.FindControl("PriceID"); Label Kinds = (Label)row.FindControl("Kinds"); TextBox TxSort = (TextBox)row.FindControl("TxSort"); DropDownList Kind = (DropDownList)row.FindControl("Kind"); TextBox ItemName = (TextBox)row.FindControl("ItemName"); DropDownList DDL_EdUnit = (DropDownList)row.FindControl("DDL_EdUnit"); ImageButton Complex = (ImageButton)row.FindControl("Complex"); TextBox Code = (TextBox)row.FindControl("Code"); TextBox Quantity = (TextBox)row.FindControl("Quantity"); TextBox Notes = (TextBox)row.FindControl("Notes"); //if (datacheck(ItemName.Text, DDL_EdUnit.SelectedValue) == false) //{ DataRow DataTableDr = DataTableBox.NewRow(); DataTableBox.Clear(); if (DataTableBox.Rows.Count != 0 || ItemName.Text != "") { DataTableDr["Pid"] = Session["ProjectCode"].ToString(); DataTableDr["PriceID"] = PriceID.Text; //DataTableDr["SortNum"] = TxSort.Text; DataTableDr["ItemKind"] = Kind.SelectedValue; DataTableDr["ItemName"] = ItemName.Text; DataTableDr["Unit"] = DDL_EdUnit.SelectedValue; DataTableDr["Complex"] = (Complex.Visible == true) ? "1" : (Complex.Visible == false) ? "2" : "0"; DataTableDr["Code"] = Code.Text; DataTableDr["AnaNumber"] = Quantity.Text; DataTableDr["Notes"] = Notes.Text; DataTableBox.Rows.Add(DataTableDr); #endregion //插入關係資料表建立關係 if (TxSort.Text != "" && ItemName.Text != "" && Quantity.Text != "") { if (!delfalg) { string SQLString2 = "Delete from Pro_Analysis where ParentID=" + Session["PriceID"].ToString() + ""; result = WebModel.SQLAction(database, SQLString2); delfalg = true; } if (Kinds.Text == "0") { DataTableBox.Columns.Remove("PriceID"); //DataTableDr["Bid"] = Session["Bid"].ToString(); result3 = WebModel.SaveAction(database, "Pro_Resource", DataTableBox); DataTableBox.Columns.Add("PriceID"); } else { DataTableBox.Columns.Remove("PriceID"); result1 = WebModel.EditAction_Anyid(database, _TableName, PriceID.Text, "PriceID", DataTableBox); DataTableBox.Columns.Add("PriceID"); } if (Session["PriceID"].ToString() != PriceID.Text) { if (Kinds.Text == "0") { int sid = WebModel.MaxID(database, "Pro_Resource") - 1; string Sql2 = "insert into Pro_Analysis ([SortNum],[ParentID],[KidID],[WorkRate]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + sid + "','" + Quantity.Text + "')"; result1 = WebModel.SQLAction(database, Sql2); } else if (Kinds.Text == "1") { string Sql2 = "insert into Pro_Analysis ([SortNum],[ParentID],[KidID],[WorkRate]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + PriceID.Text + "','" + Quantity.Text + "')"; result1 = WebModel.SQLAction(database, Sql2); } else { string Sql2 = "insert into Pro_Analysis ([SortNum],[ParentID],[KidID],[WorkRate]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + PriceID.Text + "','" + Quantity.Text + "')"; result1 = WebModel.SQLAction(database, Sql2); } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請輸入工項各項內容');", true); } if (result1) { GridView2.DataBind(); ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('工項已全儲存完畢');", true); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('工項儲存失敗');", true); } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請輸入工項');", true); } // string Sql2 = "insert into Pro_Analysis ([SortNum],[ParentID],[KidID],[WorkRate]) VALUES('" + TxSort.Text + "','" + Session["PriceID"].ToString() + "', '" + PriceID.Text + "','" + Quantity.Text + "')"; // result2= WebModel.SQLAction(database, Sql2); // //更新有單價分析 // string Sql3 = "update " + _TableName + " set Complex=1 where PriceID= '" + Session["PriceID"].ToString() + "'"; // result4= WebModel.SQLAction(database, Sql3); // if (result && result1) // { // ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('工料已全儲存完畢');", true); // } // else // { // ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('工料儲存失敗');", true); // } // } // else // { // ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請輸入工料各項內容');", true); // } } // ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('請輸入工料');", true); } }
protected void Add_Click(object sender, EventArgs e) { string ErrorString = ""; ErrorString += (DDLLayer.SelectedValue) == "0" ? "請輸入階層!!\\n" : ""; ErrorString += (DDLKind.SelectedValue) == "0" ? "請輸入工項類型!!\\n" : ""; //ErrorString += (DDLDtUpper.SelectedValue) == "0" ? "請輸入上層工項!!\\n" : ""; ErrorString += (TxItemName.Text) == string.Empty ? "請輸入名稱!!\\n" : ""; //ErrorString += (RadioButtonList2.SelectedIndex == -1) ? "請選擇項次編號方式!!\\n" : ""; //確認是否全選 if (ErrorString == "") { string database = Session["DatabaseName"].ToString(); string datatable = "CBudget_WBS"; string UpdateItemOrder = ""; if (UID != "") { bool result = WebModel.EditAction_Anyid(database, "CBudget_WBS", "CWID", UID, GetDataBox1()); if (result) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 已修改完畢');", true); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 修改失敗');", true); } } else { WebModel.SaveAction(database, datatable, GetDataBox()); } string select = "Select * from ProjectM0 where Pid=" + Session["ProjectCode"].ToString(); string CBudgetNumType = WebModel.SItemName(database, select, "CBudgetNumType"); if (CBudgetNumType == "0") { bool result3 = DAL.CBLayerCodeSort.Update_order_num(Session["DatabaseName"].ToString(), Session["ProjectCode"].ToString()); UpdateItemOrder = "update CBudget_WBS set CBudget_WBS.ItemOrder = OrderName from Bid_WBSLayer join CBudget_WBS on CBudget_WBS.LayerNum=Bid_WBSLayer.LayerNum join LayerOrder on CBudget_WBS.SortNum = LayerOrder.OrderNum and Bid_WBSLayer.LayerKind = LayerOrder.Kind where Bid_WBSLayer.PID=" + Session["ProjectCode"].ToString() + ""; WebModel.SQLAction(database, UpdateItemOrder); Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode();", true);//ajax 新增階層碼 } else if (CBudgetNumType == "1") { bool result3 = DAL.CBLayerCodeSort.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.PID=" + Session["ProjectCode"].ToString() + ""; //bool result = 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);//ajax 新增階層碼 } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } Response.Write("<script>window.opener.document.getElementById('ContentPlaceHolder1_callback').click();</script>"); }
protected void BtnSave_Click(object sender, EventArgs e) { string ErrorString = ""; if (!SystemSet.IsNatural_Number(TxSubNum.Text) && TxSubNum.Text == "") { ErrorString += "分包合約編號請填英文+數字!!!!\\n"; } if (TxSubName.Text == "") { ErrorString += "分包合約名稱請填入!!!!\\n"; } //if (!SystemSet.IsDate1(TxBookInTime.Text) || TxBookInTime.Text =="") //{ // ErrorString += "預定進場日期請填日期!!!!\\n"; //} // if (DDL_ContractType.SelectedValue=="0") //{ // ErrorString += "合約種類請選擇!!!!\\n"; //} if (!SystemSet.IsNumber(TxSubmitPercent.Text) && TxSubmitPercent.Text != "") { ErrorString += "出廠證明提送請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxRequestNum.Text) && TxRequestNum.Text != "") { ErrorString += "請款次數請填數字!!!!\\n"; } if (TxRequestDate.Text == "" && TxRequestDate.Text != "") { ErrorString += "請款日請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxPayDate.Text) && TxPayDate.Text != "") { ErrorString += "付款日請填數字!!!!\\n"; } if (RadioButton1.Checked == true) { if (!SystemSet.IsNumber(TxPType1.Text) || TxPType1.Text == "") { ErrorString += "逾罰請填數字!!!!\\n"; } } if (RadioButton2.Checked) { if (!SystemSet.IsNumber(TxPType2.Text) || TxPType2.Text == "") { ErrorString += "逾罰請填數字!!!!\\n"; } } if (!SystemSet.IsNumber(TxWarrantyYear.Text) && TxWarrantyYear.Text != "") { ErrorString += "保固年限請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxTaxPercent.Text) && TxTaxPercent.Text != "") { ErrorString += "稅額百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxPrepayPercent.Text) && TxPrepayPercent.Text != "") { ErrorString += "預付款百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxPrepayCash.Text) && TxPrepayCash.Text != "") { ErrorString += "預付款現金百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxPrepayCheckDay.Text) && TxPrepayCheckDay.Text != "") { ErrorString += "預付款期票天數請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxFundCash.Text) && TxFundCash.Text != "") { ErrorString += "工程款現金百分比請填數字!!!!\\n"; } //if (!SystemSet.IsNumber(TxFundCheckDay.Text) || TxFundCheckDay.Text == "") //{ // ErrorString += "工程款期票天數請填數字!!!!\\n"; //} if (!SystemSet.IsNumber(TxRetentionPercent.Text) && TxRetentionPercent.Text != "") { ErrorString += "保留款百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxRetentionCash.Text) && TxRetentionCash.Text != "") { ErrorString += "保留款現金百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxRetentionCheckDay.Text) && TxRetentionCheckDay.Text != "") { ErrorString += "保留款期票天數請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxWarrantyPercent.Text) && TxWarrantyPercent.Text != "") { ErrorString += "保固金百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxWarrantyCash.Text) && TxWarrantyCash.Text != "") { ErrorString += "保固金現金百分比請填數字!!!!\\n"; } if (!SystemSet.IsNumber(TxWarrantyCheckDay.Text) && TxWarrantyCheckDay.Text != "") { ErrorString += "保固金期票天數請填數字!!!!\\n"; } if (ErrorString == "") { string database = Session["DatabaseName"].ToString(); bool result = WebModel.EditAction_Anyid(database, "SubContract_Main", "SCID", SCID.Text, GetDataBox()); //bool edit = WebModel.EditAction(database, "SubRFQ_Firm", LbSBID.Text, GetDataBox()); if (result) { Response.Write("<script>alert('已存檔!!');</script>"); } else { Response.Write("<script>alert('存檔失敗!!');</script>"); } } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true); } }