private void listSub_Click(object sender, EventArgs e) { clsSLBAL SlBAL = new clsSLBAL(); clsSLBO SlBO = new clsSLBO(); //string crt = "GLID"; SlBO = SlBAL.GetValue(Convert.ToString(listSub.SelectedValue)); txtID.Text = SlBO.GetSLID(); txtDesc.Text = SlBO.GetSL_L_NAME(); txtAdd1.Text = SlBO.GetSLADD1(); txtAdd2.Text = SlBO.GetSLADD2(); txtCity.Text = SlBO.GetSLCITY(); txtPin.Text = SlBO.GetSLPIN(); txtPhone.Text = SlBO.GetSLPHONE(); txtFax.Text = SlBO.GetSLFAX(); txtContact.Text = SlBO.GetSLCONT_PERS(); txtRem.Text = SlBO.GetREMARKS(); txtOpen.Text = Convert.ToString(Math.Abs(SlBO.Getop_bal())); textBox1.Text = SlBO.Getgstin(); if (SlBO.Getop_bal() >= 0) { radioButton1.Checked = true; //cmbOpenType.Text = "Dr"; } else { radioButton2.Checked = true; //cmbOpenType.Text = "Cr"; } if (Convert.ToString(SlBO.GetGLID()) == "00004" || Convert.ToString(SlBO.GetGLID()) == "00003") { if (Convert.ToString(SlBO.GetSTATUS()) == "G") { cmbType.Text = "General"; } else if (Convert.ToString(SlBO.GetSTATUS()) == "C") { cmbType.Text = "Customer"; } else if (Convert.ToString(SlBO.GetSTATUS()) == "S") { cmbType.Text = "Supplier"; } } if (SlBO.GetSL_L_NAME() != "") { btnSave.Text = "&Update"; } else { btnSave.Text = "&Save"; } }
public String SaveData(clsSLBO SlBO) { SqlCommand cmd = new SqlCommand(); String Result; cmd.CommandText = "Insert into TblSLMast(Finyr,BrCode,GLID,SLID,SL_L_NAME,SLADD1,SLADD2,SLCITY,SLPIN,SLFAX,SLPHONE,SLCONT_PERS,REMARKS,OP_BAL,STATUS,GSTIN)" + "Values(@Finyr,@BrCode,@GLID,@SLID,@SL_L_NAME,@SLADD1,@SLADD2,@SLCITY,@SLPIN,@SLFAX,@SLPHONE,@SLCONT_PERS,@REMARKS,@OP_BAL,@STATUS,@GSTIN)"; cmd.Connection = clsConnection.Conn; try { cmd.Parameters.AddWithValue("@Finyr", SlBO.Getfinyr()); cmd.Parameters.AddWithValue("@BrCode", SlBO.GetBrCode()); cmd.Parameters.AddWithValue("@GLID", SlBO.GetGLID()); cmd.Parameters.AddWithValue("@SLID", SlBO.GetSLID()); cmd.Parameters.AddWithValue("@SL_L_NAME", SlBO.GetSL_L_NAME()); cmd.Parameters.AddWithValue("@SLADD1", SlBO.GetSLADD1()); cmd.Parameters.AddWithValue("@SLADD2", SlBO.GetSLADD2()); cmd.Parameters.AddWithValue("@SLCITY", SlBO.GetSLCITY()); cmd.Parameters.AddWithValue("@SLPIN", SlBO.GetSLPIN()); cmd.Parameters.AddWithValue("@SLFAX", SlBO.GetSLFAX()); cmd.Parameters.AddWithValue("@SLPHONE", SlBO.GetSLPHONE()); cmd.Parameters.AddWithValue("@SLCONT_PERS", SlBO.GetSLCONT_PERS()); cmd.Parameters.AddWithValue("@REMARKS", SlBO.GetREMARKS()); cmd.Parameters.AddWithValue("@op_bal", SlBO.Getop_bal()); cmd.Parameters.AddWithValue("@STATUS", SlBO.GetSTATUS()); cmd.Parameters.AddWithValue("@GSTIN", SlBO.Getgstin()); cmd.ExecuteNonQuery(); Result = "Record Inserted Successfully"; } catch (Exception) { //Logger.LogInfo(ex); //Logger.LogInfo("Patient Registration failed"); Result = "Please check all Inputs"; } cmd.Dispose(); return(Result); }
public string UpdateData(clsSLBO SlBO) { SqlCommand cmd = new SqlCommand(); String Result; cmd.CommandText = "Update TblSLMast set SL_L_NAME=@SL_L_NAME,SLADD1=@SLADD1,SLADD2=@SLADD2,SLCITY=@SLCITY,SLPIN=@SLPIN,SLFAX=@SLFAX,SLPHONE=@SLPHONE,SLCONT_PERS=@SLCONT_PERS,REMARKS=@REMARKS,OP_BAL=@OP_BAL,STATUS=@STATUS,GSTIN=@GSTIN where SLID = '" + SlBO.GetSLID() + "' and BrCode='" + Global.branch + "' and finyr='" + Global.finyr + "'"; cmd.Connection = clsConnection.Conn; try { cmd.Parameters.AddWithValue("@Finyr", SlBO.Getfinyr()); cmd.Parameters.AddWithValue("@BrCode", SlBO.GetBrCode()); cmd.Parameters.AddWithValue("@GLID", SlBO.GetGLID()); cmd.Parameters.AddWithValue("@SLID", SlBO.GetSLID()); cmd.Parameters.AddWithValue("@SL_L_NAME", SlBO.GetSL_L_NAME()); cmd.Parameters.AddWithValue("@SLADD1", SlBO.GetSLADD1()); cmd.Parameters.AddWithValue("@SLADD2", SlBO.GetSLADD2()); cmd.Parameters.AddWithValue("@SLCITY", SlBO.GetSLCITY()); cmd.Parameters.AddWithValue("@SLPIN", SlBO.GetSLPIN()); cmd.Parameters.AddWithValue("@SLFAX", SlBO.GetSLFAX()); cmd.Parameters.AddWithValue("@SLPHONE", SlBO.GetSLPHONE()); cmd.Parameters.AddWithValue("@SLCONT_PERS", SlBO.GetSLCONT_PERS()); cmd.Parameters.AddWithValue("@REMARKS", SlBO.GetREMARKS()); cmd.Parameters.AddWithValue("@op_bal", SlBO.Getop_bal()); cmd.Parameters.AddWithValue("@STATUS", SlBO.GetSTATUS()); cmd.Parameters.AddWithValue("@GSTIN", SlBO.Getgstin()); cmd.ExecuteNonQuery(); Result = "Record Updated Successfully"; } catch (Exception ex) { Result = ex.Message; } cmd.Dispose(); return(Result); }