示例#1
0
        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);
            }
        }
示例#2
0
        protected void BtnAddSubC_Click(object sender, EventArgs e)
        {
            //bool SubNum = SystemSet.IsNumberLetter(TxSubNum.Text);
            string ErrorString = "";
            string Update      = "";

            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(TxPrepayCheck.Text) || TxPrepayCheck.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(TxRetentionCheck.Text) || TxRetentionCheck.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(TxWarrantyCheck.Text) || TxWarrantyCheck.Text == "")
            //{
            //    ErrorString += "保固金期票百分比請填數字!!!!\\n";
            //}
            if (!SystemSet.IsNumber(TxWarrantyCheckDay.Text) && TxWarrantyCheckDay.Text != "")
            {
                ErrorString += "保固金期票天數請填數字!!!!\\n";
            }
            if (ErrorString == "")
            {
                string    database  = Session["DatabaseName"].ToString();
                string    SQLString = "SCID,ItemName,Unit,BelongEWID,BelongItem,SCNumber,UnitPrice,ComplexPrice,Explan,ClearWay,Note";
                DataTable DataTable = new DataTable();

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

                DataRow DataTableDr = DataTable.NewRow();

                string    SQLSItem     = "select * from SubBudget_Item a left join SubRFQ_Material b on a.SBID=b.SBID and a.SB_MID=b.SB_MID where a.SBID=" + LbSBID.Text + " and b.FirmID=" + LbFirmID.Text;
                DataTable DataTableBox = WebModel.LoadSetContentData(database, SQLSItem);
                if (DataTableBox != null && DataTableBox.Rows.Count > 0)
                {
                    foreach (DataRow row in DataTableBox.Rows)
                    {
                        //string SB_MID = row["SB_MID"].ToString();
                        int    SCID         = WebModel.MaxID(database, "SubContract_Main");
                        string ItemName     = row["ItemName"].ToString();
                        string Unit         = row["Unit"].ToString();
                        string BelongEWID   = row["BelongEWID"].ToString();
                        string BelongItem   = row["BelongItem"].ToString();
                        string SCNumber     = row["SCNumber"].ToString();
                        string UnitPrice    = row["UnitPrice"].ToString();
                        string ComplexPrice = row["ComplexPrice"].ToString();
                        string Explan       = row["Explan"].ToString();
                        string Note         = row["Note"].ToString();

                        DataTableDr["SCID"]       = SCID;
                        DataTableDr["ItemName"]   = ItemName;
                        DataTableDr["Unit"]       = Unit;
                        DataTableDr["BelongEWID"] = BelongEWID != ""?int.Parse(BelongEWID):0;
                        DataTableDr["BelongItem"] = BelongItem;
                        DataTableDr["SCNumber"]   = SCNumber != "" ? decimal.Parse(SCNumber) : 0;
                        //DataTableDr["LastSCNumber"] = SCNumber != "" ? decimal.Parse(SCNumber) : 0;
                        DataTableDr["UnitPrice"]    = UnitPrice != "" ? decimal.Parse(UnitPrice) : 0;
                        DataTableDr["ComplexPrice"] = ComplexPrice != "" ? decimal.Parse(ComplexPrice) : 0;
                        //DataTableDr["LastComplexPrice"] = ComplexPrice != "" ? decimal.Parse(ComplexPrice) : 0;
                        DataTableDr["Explan"] = Explan;
                        DataTableDr["Note"]   = Note;

                        DataTable.Rows.Add(DataTableDr);
                        WebModel.SaveAction(database, "SubContract_Item", DataTable);
                        DataTable.Rows.Clear();
                        Update = "Update SubBudgetList Set SCID='" + SCID + "' where SBID=" + LbSBID.Text;
                    }
                }

                bool   result1 = WebModel.SQLAction(database, Update);
                string result  = WebModel.SaveAction(database, "SubContract_Main", GetDataBox());
                //bool edit = WebModel.EditAction(database, "SubRFQ_Firm", LbSBID.Text, GetDataBox());
                if (result == "1")
                {
                    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);
            }
        }