private HSCodeInfo GetHSCode() { Hashtable hs = new Hashtable(); HSCodeInfo hscodeinfo = new HSCodeInfo(); hscodeinfo.HS_CODE = this.txtHSCode.Text.Trim(); hscodeinfo.HS_NAME = this.txtHSCodeName.Text.Trim(); hscodeinfo.UNIT_1 = this.dropUnit1.SelectedValue; hscodeinfo.UNIT_2 = this.dropUnit2.SelectedValue; hscodeinfo.CONTROL_MA = this.txtControlMa.Text.Trim(); hscodeinfo.NOTE_S = this.txtNote.Text.Trim(); hscodeinfo.CONTROL_INSPECTION = this.txtControlInspection.Text.Trim(); hscodeinfo.LOW_RATE = decimal.Parse(Globals.HtmlEncode(this.txtLowRate.Text.Trim())); hscodeinfo.HIGH_RATE = decimal.Parse(Globals.HtmlEncode(this.txtHighRate.Text.Trim())); hscodeinfo.OUT_RATE = decimal.Parse(Globals.HtmlEncode(this.txtOutRate.Text.Trim())); hscodeinfo.TAX_RATE = decimal.Parse(Globals.HtmlEncode(this.txtTaxRate.Text.Trim())); hscodeinfo.TSL_RATE = decimal.Parse(Globals.HtmlEncode(this.txtTslRate.Text.Trim())); hscodeinfo.TEMP_IN_RATE = decimal.Parse(Globals.HtmlEncode(this.txtTempInRate.Text.Trim())); hscodeinfo.TEMP_OUT_RATE = decimal.Parse(Globals.HtmlEncode(this.txtTempOutRate.Text.Trim())); hscodeinfo.CONSUMPTION_RATE = decimal.Parse(Globals.HtmlEncode(this.txtConsumptionRate.Text.Trim())); DataSet ds = this.CreateTable(); if (ds != null) { hscodeinfo.FND_HS_ELMENTS = ds; } return(hscodeinfo); }
private void btnSave_Click(object sender, EventArgs e) { HSCodeInfo hscodeinfo = this.GetHSCode(); if (HSCodeHelper.AddHSCodeInfo(hscodeinfo) > 0) { base.Response.Redirect(Globals.GetAdminAbsolutePath("/HS/HSCode.aspx"), true); return; } else { this.ShowMsg("添加海关编码失败,未知错误", false); } }
public int AddHSCodeInfo(HSCodeInfo hscodeinfo) { //DbCommand sqlStringCommand = // this.database.GetSqlStringCommand("INSERT INTO Ecshop_BrandCategories(BrandName, Logo, CompanyUrl,RewriteName,MetaKeywords,MetaDescription, Description, DisplaySequence) VALUES(@BrandName, @Logo, @CompanyUrl,@RewriteName,@MetaKeywords,@MetaDescription, @Description, @DisplaySequence);"); DbCommand sqlStringCommand = this.database.GetStoredProcCommand("cp_HSCode_Create"); this.database.AddOutParameter(sqlStringCommand, "HS_CODE_ID", DbType.Int32, 32); this.database.AddInParameter(sqlStringCommand, "HS_CODE", DbType.String, hscodeinfo.HS_CODE); this.database.AddInParameter(sqlStringCommand, "HS_NAME", DbType.String, hscodeinfo.HS_NAME); this.database.AddInParameter(sqlStringCommand, "LOW_RATE", DbType.Decimal, hscodeinfo.LOW_RATE); this.database.AddInParameter(sqlStringCommand, "HIGH_RATE", DbType.Decimal, hscodeinfo.HIGH_RATE); this.database.AddInParameter(sqlStringCommand, "OUT_RATE", DbType.Decimal, hscodeinfo.OUT_RATE); this.database.AddInParameter(sqlStringCommand, "TAX_RATE", DbType.Decimal, hscodeinfo.TAX_RATE); this.database.AddInParameter(sqlStringCommand, "TSL_RATE", DbType.Decimal, hscodeinfo.TSL_RATE); this.database.AddInParameter(sqlStringCommand, "UNIT_1", DbType.String, hscodeinfo.UNIT_1); this.database.AddInParameter(sqlStringCommand, "UNIT_2", DbType.String, hscodeinfo.UNIT_2); this.database.AddInParameter(sqlStringCommand, "CONTROL_MA", DbType.String, hscodeinfo.CONTROL_MA); this.database.AddInParameter(sqlStringCommand, "TEMP_IN_RATE", DbType.Decimal, hscodeinfo.TEMP_IN_RATE); this.database.AddInParameter(sqlStringCommand, "TEMP_OUT_RATE", DbType.Decimal, hscodeinfo.TEMP_OUT_RATE); this.database.AddInParameter(sqlStringCommand, "NOTE_S", DbType.String, hscodeinfo.NOTE_S); this.database.AddInParameter(sqlStringCommand, "CONTROL_INSPECTION", DbType.String, hscodeinfo.CONTROL_INSPECTION); this.database.AddInParameter(sqlStringCommand, "CONSUMPTION_RATE", DbType.Decimal, hscodeinfo.CONSUMPTION_RATE); this.database.AddInParameter(sqlStringCommand, "VOIDED", DbType.Int32, 0); int result = this.database.ExecuteNonQuery(sqlStringCommand); int HS_CODE_ID = (int)this.database.GetParameterValue(sqlStringCommand, "HS_CODE_ID"); if (hscodeinfo.FND_HS_ELMENTS != null) { DataSet ds = hscodeinfo.FND_HS_ELMENTS; DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { DbCommand sqlStringCommand1 = this.database.GetSqlStringCommand("INSERT INTO FND_HS_CODE_ELMENTS ( HS_ELMENTS_ID, HS_ELMENTS_NAME , HS_ELMENTS_DESC , HS_CODE_ID , VOIDED ) VALUES (@HS_ELMENTS_ID, @HS_ELMENTS_NAME, @HS_ELMENTS_DESC, @HS_CODE_ID, @VOIDED)"); this.database.AddInParameter(sqlStringCommand1, "HS_ELMENTS_ID", DbType.Int32, dr["HS_ELMENTS_ID"]); this.database.AddInParameter(sqlStringCommand1, "HS_ELMENTS_NAME", DbType.String, dr["HS_ELMENTS_NAME"].ToString()); this.database.AddInParameter(sqlStringCommand1, "HS_ELMENTS_DESC", DbType.String, dr["HS_ELMENTS_DESC"].ToString()); this.database.AddInParameter(sqlStringCommand1, "HS_CODE_ID", DbType.Int32, HS_CODE_ID); this.database.AddInParameter(sqlStringCommand1, "VOIDED", DbType.Int32, 0); result = this.database.ExecuteNonQuery(sqlStringCommand1); } } return(result); }
public static bool UpdateHSCodeInfo(HSCodeInfo hscodeinfo) { return(new HSCodeDao().UpdateHSCodeInfo(hscodeinfo)); }
public static int AddHSCodeInfo(HSCodeInfo hscodeinfo) { return(new HSCodeDao().AddHSCodeInfo(hscodeinfo)); }
public bool UpdateHSCodeInfo(HSCodeInfo hscodeinfo) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE FND_HS_CODE SET HS_CODE=@HS_CODE ,HS_NAME=@HS_NAME ,LOW_RATE=@LOW_RATE ,HIGH_RATE=@HIGH_RATE ,OUT_RATE=@OUT_RATE ,TAX_RATE=@TAX_RATE ,TSL_RATE=@TSL_RATE ,UNIT_1=@UNIT_1 ,UNIT_2=@UNIT_2 ,CONTROL_MA=@CONTROL_MA ,NOTE_S=@NOTE_S ,TEMP_IN_RATE=@TEMP_IN_RATE ,TEMP_OUT_RATE=@TEMP_OUT_RATE ,CONTROL_INSPECTION=@CONTROL_INSPECTION ,CONSUMPTION_RATE=@CONSUMPTION_RATE where HS_CODE_ID=@HS_CODE_ID"); this.database.AddInParameter(sqlStringCommand, "HS_CODE_ID", DbType.Int32, hscodeinfo.HS_CODE_ID); this.database.AddInParameter(sqlStringCommand, "HS_CODE", DbType.String, hscodeinfo.HS_CODE); this.database.AddInParameter(sqlStringCommand, "HS_NAME", DbType.String, hscodeinfo.HS_NAME); this.database.AddInParameter(sqlStringCommand, "LOW_RATE", DbType.Decimal, hscodeinfo.LOW_RATE); this.database.AddInParameter(sqlStringCommand, "HIGH_RATE", DbType.Decimal, hscodeinfo.HIGH_RATE); this.database.AddInParameter(sqlStringCommand, "OUT_RATE", DbType.Decimal, hscodeinfo.OUT_RATE); this.database.AddInParameter(sqlStringCommand, "TAX_RATE", DbType.Decimal, hscodeinfo.TAX_RATE); this.database.AddInParameter(sqlStringCommand, "TSL_RATE", DbType.Decimal, hscodeinfo.TSL_RATE); this.database.AddInParameter(sqlStringCommand, "UNIT_1", DbType.String, hscodeinfo.UNIT_1); this.database.AddInParameter(sqlStringCommand, "UNIT_2", DbType.String, hscodeinfo.UNIT_2); this.database.AddInParameter(sqlStringCommand, "CONTROL_MA", DbType.String, hscodeinfo.CONTROL_MA); this.database.AddInParameter(sqlStringCommand, "TEMP_IN_RATE", DbType.Decimal, hscodeinfo.TEMP_IN_RATE); this.database.AddInParameter(sqlStringCommand, "TEMP_OUT_RATE", DbType.Decimal, hscodeinfo.TEMP_OUT_RATE); this.database.AddInParameter(sqlStringCommand, "NOTE_S", DbType.String, hscodeinfo.NOTE_S); this.database.AddInParameter(sqlStringCommand, "CONTROL_INSPECTION", DbType.String, hscodeinfo.CONTROL_INSPECTION); this.database.AddInParameter(sqlStringCommand, "CONSUMPTION_RATE", DbType.Decimal, hscodeinfo.CONSUMPTION_RATE); int result = this.database.ExecuteNonQuery(sqlStringCommand); if (result > 0) { if (hscodeinfo.FND_HS_ELMENTS != null) { DbCommand sqlStringCommand1 = this.database.GetSqlStringCommand("DELETE FROM FND_HS_CODE_ELMENTS WHERE HS_CODE_ID = @HS_CODE_ID"); this.database.AddInParameter(sqlStringCommand1, "HS_CODE_ID", DbType.Int32, hscodeinfo.HS_CODE_ID); result = this.database.ExecuteNonQuery(sqlStringCommand1); if (result >= 0) { DataSet ds = hscodeinfo.FND_HS_ELMENTS; DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { DbCommand sqlStringCommand2 = this.database.GetSqlStringCommand("INSERT INTO FND_HS_CODE_ELMENTS ( HS_ELMENTS_ID, HS_ELMENTS_NAME , HS_ELMENTS_DESC , HS_CODE_ID , VOIDED ) VALUES (@HS_ELMENTS_ID, @HS_ELMENTS_NAME, @HS_ELMENTS_DESC, @HS_CODE_ID, @VOIDED)"); this.database.AddInParameter(sqlStringCommand2, "HS_ELMENTS_ID", DbType.Int32, dr["HS_ELMENTS_ID"]); this.database.AddInParameter(sqlStringCommand2, "HS_ELMENTS_NAME", DbType.String, dr["HS_ELMENTS_NAME"].ToString()); this.database.AddInParameter(sqlStringCommand2, "HS_ELMENTS_DESC", DbType.String, dr["HS_ELMENTS_DESC"].ToString()); this.database.AddInParameter(sqlStringCommand2, "HS_CODE_ID", DbType.Int32, hscodeinfo.HS_CODE_ID); this.database.AddInParameter(sqlStringCommand2, "VOIDED", DbType.Int32, 0); result = this.database.ExecuteNonQuery(sqlStringCommand2); } if (result > 0) { return(true); } } } else { DbCommand sqlStringCommand1 = this.database.GetSqlStringCommand("DELETE FROM FND_HS_CODE_ELMENTS WHERE HS_CODE_ID = @HS_CODE_ID"); this.database.AddInParameter(sqlStringCommand1, "HS_CODE_ID", DbType.Int32, hscodeinfo.HS_CODE_ID); result = this.database.ExecuteNonQuery(sqlStringCommand1); if (result >= 0) { return(true); } } } return(false); }