Exemplo n.º 1
0
        public object UpdateHcProductcartInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    HcProductcartEntity hcProductcartEntity = (HcProductcartEntity)param;
                    HcProductcartDAL    hcProductcartDAL    = new HcProductcartDAL();
                    retObj = (object)hcProductcartDAL.UpdateHcProductcartInfo(hcProductcartEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
Exemplo n.º 2
0
        public bool UpdateHcProductcartInfo(HcProductcartEntity hcProductcartEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE HC_ProductCart SET productId= @Productid, productName= @Productname, productCategoryId= @Productcategoryid, productCategoryName= @Productcategoryname, productImageUrl= @Productimageurl, productPrice= @Productprice, productQnty= @Productqnty, createdBy= @Createdby, createdAt= @Createdat, cartStatus= @Cartstatus WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcProductcartEntity.Id);
            db.AddInParameter(dbCommand, "Productid", DbType.String, hcProductcartEntity.Productid);
            db.AddInParameter(dbCommand, "Productname", DbType.String, hcProductcartEntity.Productname);
            db.AddInParameter(dbCommand, "Productcategoryid", DbType.String, hcProductcartEntity.Productcategoryid);
            db.AddInParameter(dbCommand, "Productcategoryname", DbType.String, hcProductcartEntity.Productcategoryname);
            db.AddInParameter(dbCommand, "Productimageurl", DbType.String, hcProductcartEntity.Productimageurl);
            db.AddInParameter(dbCommand, "Productprice", DbType.String, hcProductcartEntity.Productprice);
            db.AddInParameter(dbCommand, "Productqnty", DbType.String, hcProductcartEntity.Productqnty);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, hcProductcartEntity.Createdby);
            db.AddInParameter(dbCommand, "Createdat", DbType.String, hcProductcartEntity.Createdat);
            db.AddInParameter(dbCommand, "Cartstatus", DbType.String, hcProductcartEntity.Cartstatus);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Exemplo n.º 3
0
        public DataTable GetAllHcProductcartRecord(object param)
        {
            Database db  = DatabaseFactory.CreateDatabase();
            string   sql = @"SELECT A.ID, A.productId,B.MedicineName,  A.productCategoryId,  C.categoryName, B.ImageUrl, A.productPrice, A.productQnty, A.createdBy, A.createdAt, A.cartStatus 
                            FROM HC_ProductCart A, HC_Medicine B , HC_ProductCategory C
                            where A.productId = B.Id
                            AND A.productCategoryId = C.Id
                            and 1=1";

            HcProductcartEntity obj = new HcProductcartEntity();

            if (param != null)
            {
                obj = (HcProductcartEntity)param;
            }

            if (!string.IsNullOrEmpty(obj.Createdby))
            {
                sql += " And A.createdBy = '" + obj.Createdby + "'";
            }
            if (!string.IsNullOrEmpty(obj.Productid))
            {
                sql += " And A.productId = '" + obj.Productid + "'";
            }
            if (!string.IsNullOrEmpty(obj.Id))
            {
                sql += " And A.ID ='" + obj.Id + "'";
            }
            if (!string.IsNullOrEmpty(obj.Productid))
            {
                sql += " And A.cartStatus = 'Pending'";
            }



            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            return(ds.Tables[0]);
        }
Exemplo n.º 4
0
        public object SaveHcProductcartInfo(HcProductcartEntity hcProductcartEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "INSERT INTO HC_ProductCart ( productId, productName, productCategoryId, productCategoryName, productImageUrl, productPrice, productQnty, createdBy, createdAt, cartStatus) output inserted.ID VALUES (  @Productid,  @Productname,  @Productcategoryid,  @Productcategoryname,  @Productimageurl,  @Productprice,  @Productqnty,  @Createdby,  @Createdat,  @Cartstatus )";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Productid", DbType.String, hcProductcartEntity.Productid);
            db.AddInParameter(dbCommand, "Productname", DbType.String, hcProductcartEntity.Productname);
            db.AddInParameter(dbCommand, "Productcategoryid", DbType.String, hcProductcartEntity.Productcategoryid);
            db.AddInParameter(dbCommand, "Productcategoryname", DbType.String, hcProductcartEntity.Productcategoryname);
            db.AddInParameter(dbCommand, "Productimageurl", DbType.String, hcProductcartEntity.Productimageurl);
            db.AddInParameter(dbCommand, "Productprice", DbType.String, hcProductcartEntity.Productprice);
            db.AddInParameter(dbCommand, "Productqnty", DbType.String, hcProductcartEntity.Productqnty);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, hcProductcartEntity.Createdby);
            db.AddInParameter(dbCommand, "Createdat", DbType.String, hcProductcartEntity.Createdat);
            db.AddInParameter(dbCommand, "Cartstatus", DbType.String, hcProductcartEntity.Cartstatus);

            //db.ExecuteNonQuery(dbCommand, transaction);
            //return true;
            var id = db.ExecuteScalar(dbCommand, transaction).ToString();

            return(id);
        }
Exemplo n.º 5
0
        public HcProductcartEntity GetSingleHcProductcartRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, productId, productName, productCategoryId, productCategoryName, productImageUrl, productPrice, productQnty, createdBy, createdAt, cartStatus FROM HC_ProductCart WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            HcProductcartEntity hcProductcartEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    hcProductcartEntity = new HcProductcartEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        hcProductcartEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["productId"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productid = dataReader["productId"].ToString();
                    }
                    if (dataReader["productName"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productname = dataReader["productName"].ToString();
                    }
                    if (dataReader["productCategoryId"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productcategoryid = dataReader["productCategoryId"].ToString();
                    }
                    if (dataReader["productCategoryName"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productcategoryname = dataReader["productCategoryName"].ToString();
                    }
                    if (dataReader["productImageUrl"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productimageurl = dataReader["productImageUrl"].ToString();
                    }
                    if (dataReader["productPrice"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productprice = dataReader["productPrice"].ToString();
                    }
                    if (dataReader["productQnty"] != DBNull.Value)
                    {
                        hcProductcartEntity.Productqnty = dataReader["productQnty"].ToString();
                    }
                    if (dataReader["createdBy"] != DBNull.Value)
                    {
                        hcProductcartEntity.Createdby = dataReader["createdBy"].ToString();
                    }
                    if (dataReader["createdAt"] != DBNull.Value)
                    {
                        hcProductcartEntity.Createdat = dataReader["createdAt"].ToString();
                    }
                    if (dataReader["cartStatus"] != DBNull.Value)
                    {
                        hcProductcartEntity.Cartstatus = dataReader["cartStatus"].ToString();
                    }
                }
            }
            return(hcProductcartEntity);
        }