//*******COPY IT TO USE BELOW FUNCTION - INSERT************ //try //{ // LIBtblmstPerformance objLIBtblmstPerformance = new LIBtblmstPerformance(); // DALtblmstPerformance objDALtblmstPerformance = new DALtblmstPerformance(); // MyCLS.TransportationPacket tp = new MyCLS.TransportationPacket(); // objLIBtblmstPerformance.id = txt.Text; // objLIBtblmstPerformance.orgid = txt.Text; // objLIBtblmstPerformance.LatestPerformance = txt.Text; // objLIBtblmstPerformance.PerLevel = txt.Text; // tp.MessagePacket = objLIBtblmstPerformance; // tp = objDALtblmstPerformance.InserttblmstPerformance(tp); // if(tp.MessageId > -1) //{ // string[] strOutParamValues = (string[])tp.MessageResultset; // MessageBox.Show(strOutParamValues[0].ToString()); // } // } //catch(Exception ex) //{ // MyCLS.clsHandleException.HandleEx(ex, System.Reflection.MethodBase.GetCurrentMethod().ToString(), true); //} /// <summary> /// Accepts=Packet, Return=Packet, Result=Packet.MessageId, Return Values=Packet.MessageResultset /// </summary> /// <param name="Packet"></param> /// <returns></returns> /// <remarks></remarks> public MyCLS.TransportationPacket InserttblmstPerformance(MyCLS.TransportationPacket Packet) { String[] strOutParamValues = new String[10]; List <SqlParameter> objParamList = new List <SqlParameter>(); List <SqlParameter> objParamListOut = new List <SqlParameter>(); MyCLS.clsExecuteStoredProcSql clsESPSql = new MyCLS.clsExecuteStoredProcSql(); int Result = 0; try { LIBtblmstPerformance objLIBtblmstPerformance = new LIBtblmstPerformance(); objLIBtblmstPerformance = (LIBtblmstPerformance)Packet.MessagePacket; objParamList.Add(new SqlParameter("@id", objLIBtblmstPerformance.id)); objParamList.Add(new SqlParameter("@orgid", objLIBtblmstPerformance.orgid)); objParamList.Add(new SqlParameter("@LatestPerformance", objLIBtblmstPerformance.LatestPerformance)); objParamList.Add(new SqlParameter("@PerLevel", objLIBtblmstPerformance.PerLevel)); objParamListOut.Add(new SqlParameter("@@id", SqlDbType.Int)); strOutParamValues = clsESPSql.ExecuteSPNonQueryOutPut("SP_InserttblmstPerformance", objParamList, objParamListOut, ref Result); Packet.MessageId = Result; Packet.MessageResultset = strOutParamValues; } catch (Exception ex) { Packet.MessageId = -1; Packet.ex = ex; MyCLS.clsHandleException.HandleEx(ex, System.Reflection.MethodBase.GetCurrentMethod().ToString(), true); } return(Packet); }
//*******COPY IT TO USE BELOW FUNCTION - SELECT BY ID************ //try //{ // LIBtblmstPerformanceListing objLIBtblmstPerformanceListing = new LIBtblmstPerformanceListing(); // DALtblmstPerformance objDALtblmstPerformance = new DALtblmstPerformance(); // MyCLS.TransportationPacket tp = new MyCLS.TransportationPacket(); // DataSet ds = new DataSet(); //// txt.Text = objLIBtblmstPerformanceListing[0].id = ""; //// txt.Text = objLIBtblmstPerformanceListing[0].orgid = ""; //// txt.Text = objLIBtblmstPerformanceListing[0].LatestPerformance = ""; //// txt.Text = objLIBtblmstPerformanceListing[0].PerLevel = ""; // tp.MessagePacket = 1; //ID to be Passed // tp = objDALtblmstPerformance.GettblmstPerformanceDetails(tp); // if(tp.MessageId == 1) //{ // objLIBtblmstPerformanceListing = (LIBtblmstPerformanceListing)tp.MessageResultset; // ds = (DataSet)tp.MessageResultsetDS; // MessageBox.Show(objLIBtblmstPerformanceListing[0].ToString()); // } // } //catch(Exception ex) // { // MyCLS.clsHandleException.HandleEx(ex, System.Reflection.MethodBase.GetCurrentMethod().ToString(), true); // } /// <summary> /// Accepts=TransportationPacket, Return=Packet, Result=Packet.MessageId, Return Values=Packet.MessageResultset /// </summary> /// <returns></returns> /// <remarks></remarks> public MyCLS.TransportationPacket GettblmstPerformanceDetails(MyCLS.TransportationPacket Packet) { DataSet ds = new DataSet(); List <SqlParameter> objParamList = new List <SqlParameter>(); LIBtblmstPerformanceListing objLIBtblmstPerformanceListing = new LIBtblmstPerformanceListing(); MyCLS.clsExecuteStoredProcSql clsESPSql = new MyCLS.clsExecuteStoredProcSql(); try { objParamList.Add(new SqlParameter("@Id", Packet.MessagePacket)); ds = clsESPSql.ExecuteSPDataSet("SP_GetDetailsFromtblmstPerformanceById", objParamList); if (ds != null) { if (ds.Tables != null) { if (ds.Tables[0].Rows != null) { if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { LIBtblmstPerformance oLIBtblmstPerformance = new LIBtblmstPerformance(); objLIBtblmstPerformanceListing.Add(oLIBtblmstPerformance); objLIBtblmstPerformanceListing[i].id = (int)ds.Tables[0].Rows[i]["id"]; objLIBtblmstPerformanceListing[i].orgid = (int)ds.Tables[0].Rows[i]["orgid"]; objLIBtblmstPerformanceListing[i].LatestPerformance = ds.Tables[0].Rows[i]["LatestPerformance"].ToString(); objLIBtblmstPerformanceListing[i].PerLevel = (int)ds.Tables[0].Rows[i]["PerLevel"]; } Packet.MessageId = 1; } else { Packet.MessageId = -1; } } } } Packet.MessageResultsetDS = ds; Packet.MessageResultset = objLIBtblmstPerformanceListing; } catch (Exception ex) { Packet.MessageId = -1; Packet.ex = ex; MyCLS.clsHandleException.HandleEx(ex, System.Reflection.MethodBase.GetCurrentMethod().ToString(), true); } return(Packet); }
protected void lnkSavePerformance_Click(object sender, EventArgs e) { try { lblmsg.Text = ""; lblsuccessmsg.Text = ""; //txtSubType.Text = ""; string no = ""; int add = 0; int upd = 0; for (int i = 0; i < rptListPer.Items.Count; i++) { TextBox txtPerformance = (TextBox)rptListPer.Items[i].FindControl("txt1"); Label lblno = (Label)rptListPer.Items[i].FindControl("lblno"); HiddenField hdnid = (HiddenField)rptListPer.Items[i].FindControl("hdnid"); LIBtblmstPerformance objLIBtblmstPerformance = new LIBtblmstPerformance(); DALtblmstPerformance objDALtblmstPerformance = new DALtblmstPerformance(); MyCLS.TransportationPacket tp = new MyCLS.TransportationPacket(); if (txtPerformance.Text.Trim() != "") { if (hdnid.Value == "") { objLIBtblmstPerformance.id = -1; } else { objLIBtblmstPerformance.id = Convert.ToInt32(hdnid.Value); } objLIBtblmstPerformance.LatestPerformance = txtPerformance.Text.Trim().Length > 0 ? txtPerformance.Text.Replace("'", "''") : ""; objLIBtblmstPerformance.PerLevel = Convert.ToInt32(lblno.Text.Trim()); objLIBtblmstPerformance.orgid = Convert.ToInt32(Session["orgid"]); tp.MessagePacket = objLIBtblmstPerformance; tp = objDALtblmstPerformance.InserttblmstPerformance(tp); string[] strOutParamValues = (string[])tp.MessageResultset; if (strOutParamValues.Length > 0) { if (strOutParamValues[0].ToString() == "-3") { no = no + "," + lblno.Text.Trim(); lblmsg.ForeColor = System.Drawing.Color.Red; } else if (strOutParamValues[0].ToString() == "-2") { lblmsg.Text = lblmsg.Text + "-- " + txtPerformance.Text.Trim() + " This Performance Already Exist."; lblmsg.ForeColor = System.Drawing.Color.Red; } else { if (hdnid.Value != "") { upd = upd + 1; } else { add = add + 1; } } } } } if (add > 0 || upd > 0) { lblsuccessmsg.Text = "Performance mapping saved successfully"; } //if (upd > 0) //{ // lblsuccessmsg.Text =lblsuccessmsg.Text+"/"+ upd.ToString() + " Performance Modified Successfully"; //} bindGridPerformancedata(); //Response.Redirect(Request.Url.ToString(), false); if (no != "") { lblmsg.Text = no + " Preformance Rating should be in sequence"; } string msg = lblsuccessmsg.Text + lblmsg.Text; ClientScript.RegisterStartupScript(GetType(), "Save", "<SCRIPT LANGUAGE='javascript'>javascript:alert('" + msg + "');</script>"); // lnkSavePerformance.Text = "Add"; } catch (Exception ex) { MyCLS.clsHandleException.HandleEx(ex, System.Reflection.MethodBase.GetCurrentMethod().ToString(), true); } }