public string InsertPlantAgentwiseratechart(BOLPlantwiseRatechart prate) { string mes = string.Empty; Sqlstr = "Insert_PlantAgentwiseRatechart"; mes = dalrate.DInsertAgentwiseratechart(prate, Sqlstr); return(mes); }
public string DInsertRoutewiseratechart(BOLPlantwiseRatechart Rate, string Sql) { using (con = dbaccess.GetConnection()) { string message = String.Empty; int result = 0; SqlCommand cmd = new SqlCommand(); SqlParameter pcompanycode, pplantcode, pratechartcode, pratechartcodeBuff, parmess, parresult, pRouteId; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = Sql; cmd.Connection = con; pcompanycode = cmd.Parameters.Add("@Company_Code", SqlDbType.Int); pplantcode = cmd.Parameters.Add("@Plant_Code", SqlDbType.Int); pratechartcode = cmd.Parameters.Add("@RateChartId", SqlDbType.NVarChar, 50); pratechartcodeBuff = cmd.Parameters.Add("@RatechartIdBuff", SqlDbType.NVarChar, 50); pRouteId = cmd.Parameters.Add("@RouteId", SqlDbType.Int); parmess = cmd.Parameters.Add("@mess", SqlDbType.Char, 500); cmd.Parameters["@mess"].Direction = ParameterDirection.Output; parresult = cmd.Parameters.Add("@res", SqlDbType.Int); cmd.Parameters["@res"].Direction = ParameterDirection.Output; pcompanycode.Value = Rate.Companycode; pplantcode.Value = Rate.Plantcode; pratechartcode.Value = Rate.ChartName; pratechartcodeBuff.Value = Rate.BuffchartName; pRouteId.Value = Rate.RouteId; cmd.ExecuteNonQuery(); message = (string)cmd.Parameters["@mess"].Value; result = (int)cmd.Parameters["@res"].Value; con.Close(); if (result == 1) { //WebMsgBox.Show(message); return(message); } else if (result == 2) { //WebMsgBox.Show(message); return(message); } else { WebMsgBox.Show("Please, Check Connection"); } return(message); } }