コード例 #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 DataTable GetDataBox1()
        {
            string    ErrorString  = "";
            string    SQLString    = "Name,EIN,Type,SupportItem,Owner,OwnerMobile,Capital,StaffAmount,Location,Tel1,Tel2,Fax1,Fax2,Email,ContectAddress,RegisteredAddress,Notes";
            DataTable DataTableBox = new DataTable();

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


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

            DataRow DataTableDr = DataTableBox.NewRow();


            string FirmName    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_FirmName.Text));
            string SupportItem = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_SupportItem.Text));
            string EIN         = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_EIN.Text));
            string Owner       = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Owner.Text));
            string OwnerMobile = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_OwnerMobile.Text));
            bool   Capital     = SystemSet.Float(TBE_Capital.Text);
            bool   Staff       = SystemSet.IsNumber(TBE_Staff.Text);
            string Tel1        = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Tel1.Text));
            string Tel2        = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Tel2.Text));

            string Fax1     = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Fax1.Text));
            string Fax2     = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Fax2.Text));
            string Email    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Email.Text));
            string Caddress = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_CAddress.Text));
            string Notes    = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_Notes.Text));
            string RAddress = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TBE_RAddress.Text));

            ErrorString += (DDL_Select7.SelectedValue) == "0" ? "請輸入廠商類型!!\\n" : "";
            ErrorString += (DDL_Select8.SelectedValue) == "0" ? "請輸入所在縣市!!\\n" : "";
            ErrorString += (Capital) != true ? "請輸入數字!!\\n" : "";
            ErrorString += (Staff) != true ? "請輸入數字!!\\n" : "";
            #region 內容設定
            if (ErrorString == "")
            {
                DataTableDr["Name"]              = FirmName;
                DataTableDr["SupportItem"]       = SupportItem;
                DataTableDr["EIN"]               = EIN;
                DataTableDr["Type"]              = DDL_Select5.SelectedValue;
                DataTableDr["Owner"]             = Owner;
                DataTableDr["OwnerMobile"]       = OwnerMobile;
                DataTableDr["Capital"]           = TBE_Capital.Text != "" ? decimal.Parse(TBE_Capital.Text) : 0;
                DataTableDr["StaffAmount"]       = TBE_Staff.Text != "" ? decimal.Parse(TBE_Staff.Text) : 0;
                DataTableDr["Location"]          = DDL_Select6.SelectedValue;
                DataTableDr["Tel1"]              = Tel1;
                DataTableDr["Tel2"]              = Tel2;
                DataTableDr["Fax1"]              = Fax1;
                DataTableDr["Fax2"]              = Fax2;
                DataTableDr["Email"]             = Email;
                DataTableDr["ContectAddress"]    = Caddress;
                DataTableDr["RegisteredAddress"] = RAddress;
                DataTableDr["Notes"]             = Notes;
                DataTableDr["Type"]              = DDL_Select7.SelectedValue;
                DataTableDr["Location"]          = DDL_Select8.SelectedValue;
                DataTableBox.Rows.Add(DataTableDr);
                #endregion
            }
            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('" + ErrorString + "');", true);
            }
            return(DataTableBox);
        }
コード例 #3
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);
            }
        }