public void UpdateLeads(LeadsInfo info)
 {
     using (MySqlConnection cn = new MySqlConnection(ConString))
     {
         cn.Open();
         MySqlCommand cmd = new MySqlCommand();
         cmd.Connection  = cn;
         cmd.CommandText = "UPDATE Leads SET CVR = ('" + info.CVR + "'), Firma = ('" + info.Firma + "')," /* ... */;
         cmd.ExecuteNonQuery();
         cmd.Dispose();
         cn.Close();
     }
 }
Ejemplo n.º 2
0
    private Int64 LeadsUploadExcel(int rowNo, ref DbTransaction Transaction, ref DbConnection Connection)
    {
        Int64 refOut = 0;

        bool bfirst = true;

        DataSet   ds           = new DataSet();
        LeadsInfo objLeadsInfo = new LeadsInfo();
        LeadsBL   objleadBL    = new LeadsBL();
        DataSet   dsCampaigns  = new DataSet();
        DataView  dv           = new DataView();
        DataTable dt           = new DataTable();

        try
        {
            if (grdIntroInfo.Rows.Count > 0)
            {
                #region SalesTable


                objLeadsInfo.Phone  = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblPhoneno")).Text).ToString();
                objLeadsInfo.Header = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblHeader")).Text).ToString();
                objLeadsInfo.Price  = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblPrice")).Text).ToString();
                objLeadsInfo.State  = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblState")).Text).ToString();;
                objLeadsInfo.City   = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblCity")).Text).ToString();
                //objLeadsInfo.Zip = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblSaleBY")).Text).ToString();
                objLeadsInfo.URL           = GenFunc.ExcelTextFormat(((HyperLink)grdIntroInfo.Rows[rowNo].FindControl("lblURL")).Text).ToString();
                objLeadsInfo.VehicleTypeID = ddlVehicleType.SelectedItem.Value;
                objLeadsInfo.LeadUpBatchID = Session["FileId"].ToString();



                //objLeadsInfo.se
                //objLeadsInfo.yhe = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblSaleBY")).Text).ToString();



                //objLeadsInfo .Sales_Notes = GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("hdnSALESNOTES")).Text.ToString());

                #endregion ContactTable

                //Excel File Opening Transaction
                if (rowNo == 0)
                {
                    bfirst = true;
                }
                if (rowNo > 0)
                {
                    if (grdIntroInfo.Rows.Count - 1 == rowNo)
                    {
                        bfirst = false;
                    }
                }
                //bool bnew = CheckBTN(GenFunc.ExcelTextFormat(((Label)grdIntroInfo.Rows[rowNo].FindControl("lblPhoneno")).Text).ToString());
                //if (bnew == false)
                //{
                Count = Count + 1;
                objleadBL.SaveLeadsInfo(objLeadsInfo, bfirst, rowNo, grdIntroInfo.Rows.Count - 1, ref Transaction, ref Connection);
                Transaction = Transaction;
                Connection  = Connection;
                //}
            }
        }
        catch (Exception ex)
        {
            Transaction.Rollback();
            Connection.Close();

            //bool rethrow = ExceptionPolicy.HandleException(ex, ConstantClass.StrCRMUIPolicy);

            //if (rethrow)
            //    throw;

            //Redirecting to error message page
            //Server.Transfer(ConstantClass.StrErrorPageURL);
        }
        return(refOut);
    }
Ejemplo n.º 3
0
        public bool SaveLeadsInfo(LeadsInfo objLeadsInfo, bool bfirst, int rowNo, int LastRow, ref DbTransaction Transaction, ref DbConnection Connection)
        {
            bool bNew = false;

            string spNameString = string.Empty;


            //Connect to the database
            Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME4);

            spNameString = "[USP_SaveLeads]";

            DbCommand dbCommand = null;

            // dbCommand.CommandTimeout = 0;

            try
            {
                if (rowNo == 0)
                {
                    if (bfirst == true)
                    {
                        Global.Connection = dbDatabase.CreateConnection();
                        Global.Connection.Open();
                        Global.Transaction = Global.Connection.BeginTransaction();
                    }
                }

                //Assign stored procedure to the command object
                dbCommand = dbDatabase.GetStoredProcCommand(spNameString);

                //Assign stored procedure parameters

                dbDatabase.AddInParameter(dbCommand, "@PostingID", DbType.Int64, objLeadsInfo.PostingID);
                dbDatabase.AddInParameter(dbCommand, "@Phone", DbType.Int64, objLeadsInfo.Phone);
                dbDatabase.AddInParameter(dbCommand, "@SellerName", DbType.String, objLeadsInfo.SellerName);
                dbDatabase.AddInParameter(dbCommand, "@Price", DbType.String, objLeadsInfo.Price.ToString());
                dbDatabase.AddInParameter(dbCommand, "@Model", DbType.String, objLeadsInfo.Model);
                dbDatabase.AddInParameter(dbCommand, "@Description", DbType.String, objLeadsInfo.Description);
                dbDatabase.AddInParameter(dbCommand, "@Mileage", DbType.String, objLeadsInfo.Mileage);
                dbDatabase.AddInParameter(dbCommand, "@State", DbType.String, objLeadsInfo.State);
                dbDatabase.AddInParameter(dbCommand, "@City", DbType.String, objLeadsInfo.City);
                dbDatabase.AddInParameter(dbCommand, "@Zip", DbType.String, objLeadsInfo.Zip);
                dbDatabase.AddInParameter(dbCommand, "@URL", DbType.String, objLeadsInfo.URL);
                dbDatabase.AddInParameter(dbCommand, "@VehicleTypeID", DbType.String, objLeadsInfo.VehicleTypeID);
                dbDatabase.AddInParameter(dbCommand, "@CollectedDate", DbType.String, objLeadsInfo.CollectedDate);
                dbDatabase.AddInParameter(dbCommand, "@SellerType", DbType.String, objLeadsInfo.SellarTypeID);
                dbDatabase.AddInParameter(dbCommand, "@Heading", DbType.String, objLeadsInfo.Header);
                dbDatabase.AddInParameter(dbCommand, "@LeadUpBatchID", DbType.String, objLeadsInfo.LeadUpBatchID);



                //Executing stored procedure
                ///dsSales = dbDatabase.ExecuteDataSet(dbCommand);
                Transaction = Global.Transaction;

                Connection = Global.Connection;

                dbDatabase.ExecuteNonQuery(dbCommand, Global.Transaction);

                if (bfirst == false)
                {
                    Global.Transaction.Commit();
                    Global.Connection.Close();
                }
                else if (LastRow == rowNo)
                {
                    Global.Transaction.Commit();
                    Global.Connection.Close();
                }

                bNew = true;
            }

            catch (Exception ex)
            {
                Global.Transaction.Rollback();
                Global.Connection.Close();
                bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY);

                if (rethrow)
                {
                    throw;
                }
            }
            finally
            {
                dbDatabase = null;
            }
            return(bNew);
        }