Ejemplo n.º 1
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);
        }