Пример #1
0
        /// <summary>
        /// This Method is used for Insert and Update of LeadGeneator Master
        /// </summary>
        /// <param name="objEn"></param>
        /// <param name="OpType"></param>
        /// <returns></returns>
        public string InsertUpdate(LeadGenerator objEn, Int32 OpType)
        {
            string    msg       = string.Empty;
            DbCommand DbCommand = default(DbCommand);

            try
            {
                Database ds = default(Database);

                ds = DatabaseFactory.CreateDatabase(cnstr);

                DbCommand = ds.GetStoredProcCommand("USP_tblMstLeadGenerator_InsertUpdate");

                ds.AddInParameter(DbCommand, "LeadGeneratorID", DbType.Guid, objEn.LeadGeneratorID);
                ds.AddInParameter(DbCommand, "LeadGeneratorName", DbType.String, objEn.LeadGeneratorName);
                ds.AddInParameter(DbCommand, "ContactNo1", DbType.String, objEn.ContactNo1);
                ds.AddInParameter(DbCommand, "ContactNo2", DbType.String, objEn.ContactNo2);
                ds.AddInParameter(DbCommand, "EmailID", DbType.String, objEn.EmailID);
                //ds.AddInParameter(DbCommand, "Share", DbType.Decimal, objEn.Share);
                ds.AddInParameter(DbCommand, "EntBy", DbType.Guid, new Guid(userid));
                ds.AddInParameter(DbCommand, "Change", DbType.Int32, OpType);
                msg = ds.ExecuteNonQuery(DbCommand).ToString();
                DbCommand.Parameters.Clear();
                msg = "success";
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DbCommand.Dispose();
            }
            return(msg);
        }
Пример #2
0
        /// <summary>
        /// This Method is used to Retrive all the entries of LeadGenerator
        /// </summary>
        /// <returns></returns>
        public IEnumerable <LeadGenerator> GetAll()
        {
            List <LeadGenerator> enobjlst  = new List <LeadGenerator>();
            DbCommand            DbCommand = default(DbCommand);

            try
            {
                Database ds = DatabaseFactory.CreateDatabase(cnstr);
                DbCommand = ds.GetStoredProcCommand("USP_tblMstLeadGenerator_GetAll");

                using (IDataReader dataReader = ds.ExecuteReader(DbCommand))
                {
                    while (dataReader.Read())
                    {
                        LeadGenerator objen = new LeadGenerator();
                        DAL.EntityUtils.PopulateEntity(objen, dataReader);
                        enobjlst.Add(objen);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DbCommand.Dispose();
            }
            return(enobjlst);
        }
Пример #3
0
        /// <summary>
        /// This Method is used to get Single Entry of Lead Generator By LeadGeneratorID
        /// </summary>
        /// <param name="LGId"></param>
        /// <returns></returns>
        public LeadGenerator GetSingle(Guid LGId)
        {
            LeadGenerator entobj1   = new LeadGenerator();
            DbCommand     DbCommand = default(DbCommand);

            try
            {
                Database ds = DatabaseFactory.CreateDatabase(cnstr);
                DbCommand = ds.GetStoredProcCommand("USP_tblMstLeadGenerator_GetByID");
                ds.AddInParameter(DbCommand, "LeadGeneratorID", DbType.Guid, LGId);
                IDataReader reader = (ds.ExecuteReader(DbCommand));
                DbCommand.Parameters.Clear();

                if (reader.Read())
                {
                    DAL.EntityUtils.PopulateEntity(entobj1, reader);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DbCommand.Dispose();
            }
            return(entobj1);
        }