Exemplo n.º 1
0
        public DataSet GetFilterData(DataTable DTSubCategory, string version, string lang, string StateName, string DistrictName)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);
            CreatedOrderResult objData = new CreatedOrderResult();

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "[usp_KitchenGarden_ProductList]";
                // command.Parameters.AddWithValue("@DTCategory", DTCategory);
                command.Parameters.AddWithValue("@DTCategoryFilter", DTSubCategory);
                command.Parameters.AddWithValue("@version", version);
                command.Parameters.AddWithValue("@lang", lang);
                command.Parameters.AddWithValue("@StateName", StateName);
                command.Parameters.AddWithValue("@x_DistrictName", DistrictName);
                command.Parameters.AddWithValue("@PageIndex", 1);
                command.Parameters.AddWithValue("@PageSize", 1000);
                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }
            connection.Close();
            return(ds);
        }
Exemplo n.º 2
0
        public DataSet GetCatSubCat(int?KGP_CategoryId = null)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);
            CreatedOrderResult objData = new CreatedOrderResult();

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "[usp_CatSubCat]";
                // command.Parameters.AddWithValue("@DTCategory", DTCategory);
                command.Parameters.AddWithValue("@KGP_CategoryId", KGP_CategoryId);

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }
            connection.Close();
            return(ds);
        }
Exemplo n.º 3
0
        public CreatedOrderResult GetCreateOrderData(int OrderId)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);
            CreatedOrderResult objData = new CreatedOrderResult();

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "GetSathiOrderAmount";
                command.Parameters.AddWithValue("@OrderId", OrderId);
                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objData.OrderAmount = Convert.ToDecimal(ds.Tables[0].Rows[0]["OrderAmount"].ToString());
                    objData.OrderId     = OrderId;
                    objData.Status      = 1;
                }
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, OrderId); }


            connection.Close();
            return(objData);
        }
Exemplo n.º 4
0
        public int TempOrderUpdate(string FMobNo, string ProductId, int PackageID, int Qty, int UserId)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            int           flag    = 0;

            //string flag = "";

            connection = new SqlConnection(connetionString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_TempVideoOrderUpdate";

                command.Parameters.AddWithValue("@CreatedBy", UserId);
                command.Parameters.AddWithValue("@MobileNo", FMobNo);
                command.Parameters.AddWithValue("@Quantity", Qty);
                command.Parameters.AddWithValue("@PackageID", PackageID);
                command.Parameters.AddWithValue("@ProductId", ProductId);


                flag = command.ExecuteNonQuery();

                command.Parameters.Clear();
                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, UserId); }

            connection.Close();
            return(flag);
        }
Exemplo n.º 5
0
        public DataSet Get_Product_Detail(int productId)
        {
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_Prod_Get_Product_Detail";
                command.Parameters.AddWithValue("@productid", productId);

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }

            connection.Close();
            return(ds);
        }
Exemplo n.º 6
0
        public DataSet GetOrderDetails(string apikey, string MobNo)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);
            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "uspOrderList_ByMobNo";
                command.Parameters.AddWithValue("@MobNo", MobNo);

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }


            connection.Close();
            return(ds);
        }
        public DataSet GetTripForApprove()
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_Get_TripForApprove";

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }

            connection.Close();
            return(ds);
        }
Exemplo n.º 8
0
        public int Add_Demand_Product(int tid, int cid, int subid, string pname, string remark, int uid)
        {
            string sql = "";
            int    i   = 0;

            try
            {
                sql = StoredProcedure.Add_Demand_Product;
                SqlParameter[] parameters = new SqlParameter[6];
                parameters[0] = new SqlParameter("@TechnicalId", tid);
                parameters[1] = new SqlParameter("@CategoryId", cid);
                parameters[2] = new SqlParameter("@SubcategoryId", subid);
                parameters[3] = new SqlParameter("@ProductName", pname);
                parameters[4] = new SqlParameter("@Remarks", remark);
                parameters[5] = new SqlParameter("@CreatedBy", uid);


                i = BaseDal.ExecuteNonQuerywithSP(sql, parameters);
                if (i > 0)
                {
                    i = 1;
                }
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(i);;
        }
        public DataSet GetTransporterDetailByUserName(string userName)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_GetTransporterDetailByUserName";
                command.Parameters.AddWithValue("@username", userName);
                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }

            connection.Close();
            return(ds);
        }
Exemplo n.º 10
0
        public DataSet GetTempOrderDetail(int UseriD, string Mobileno)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_TempVideoOrderSelect";
                command.Parameters.AddWithValue("@CreatedBy", UseriD);
                command.Parameters.AddWithValue("@MobileNo", Mobileno);

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, UseriD);
            }

            connection.Close();
            return(ds);
        }
Exemplo n.º 11
0
        public int Activate_Delaer_product_package(int productid, int packageid, string remarks, int createdby)
        {
            string  sql          = "";
            DataSet ds           = new DataSet();
            int     iResult      = 0;
            int     iinsertcount = 0;

            try
            {
                sql = StoredProcedure.Activate_Dealer_Product;
                SqlParameter[] parameters = new SqlParameter[5];
                parameters[0]           = new SqlParameter("@ProductID", productid);
                parameters[1]           = new SqlParameter("@PackageID", packageid);
                parameters[2]           = new SqlParameter("@Remarks", remarks);
                parameters[3]           = new SqlParameter("@Createdby", createdby);
                parameters[4]           = new SqlParameter("@Record", 0);
                parameters[4].Direction = ParameterDirection.Output;


                iResult      = BaseDal.ExecuteNonQuerywithSP(sql, parameters);
                iinsertcount = Convert.ToInt32(parameters[4].Value);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(iinsertcount);
        }
Exemplo n.º 12
0
        public DataSet UserLogin(string UserId, string Password)
        {
            string         encodepassword = Encode(Password);
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_UserLogin";
                command.Parameters.AddWithValue("@Username", UserId);
                command.Parameters.AddWithValue("@Password", encodepassword);
                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, Convert.ToInt32(UserId));
            }


            connection.Close();
            return(ds);
        }
Exemplo n.º 13
0
        public DataSet GetProduct_Master()
        {
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_DISTINCTPRODUCTLIST"; //Reuse Bharat SP
                adapter             = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }

            connection.Close();
            return(ds);
        }
Exemplo n.º 14
0
        public DataSet GetCategorySubCategory(int id, char type)
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);

            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "GetCategorySubCategory";
                command.Parameters.AddWithValue("@Id", id);
                command.Parameters.AddWithValue("@Type", type);

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }


            connection.Close();
            return(ds);
        }
Exemplo n.º 15
0
        public DataSet GetOrderDetails_OrderID(int orderid)//Change
        {
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);
            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "GetOrderDetails_OrderID";
                command.Parameters.AddWithValue("@OrderID", orderid);
                // command.Parameters.AddWithValue("@userid", userid);
                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }


            connection.Close();
            return(ds);
        }
Exemplo n.º 16
0
        public DataSet Get_Dealer_Accepted_product(int dealerID, string status, int?stateid = 0, int?districtId = 0, int?blockID = 0, int?category = 0, int?subcategory = 0, int?techid = 0, int?companyid = 0, int?brandid = 0)
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.ACCEPTED_PRODUCTLIST_Master;
                SqlParameter[] parameters = new SqlParameter[10];
                if (dealerID > 0)
                {
                    parameters[0] = new SqlParameter("@DealerId", dealerID);
                }
                parameters[1] = new SqlParameter("@status", status);
                parameters[2] = new SqlParameter("@StateID", stateid);
                parameters[3] = new SqlParameter("@DistrictID", districtId);
                parameters[4] = new SqlParameter("@BlockID", blockID);
                parameters[5] = new SqlParameter("@CategoryID", category);
                parameters[6] = new SqlParameter("@SubCategoryID", subcategory);
                parameters[7] = new SqlParameter("@TechnicalNameID", techid);
                parameters[8] = new SqlParameter("@CompanyID", companyid);
                parameters[9] = new SqlParameter("@BrandID", brandid);

                ds = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }
Exemplo n.º 17
0
        public ApiPostResponse SaveTractorUserDetail(string FarmerName, int StateId, string MobileNo, int CategoryId, int BzProductId, string ModelNo,
                                                     decimal QuotationPrice, string RequestSource, string DemoDate, string TimeSlot)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();

            System.Data.SqlTypes.SqlDateTime sqldatenul;
            string Msg = "";

            connection = new SqlConnection(connetionString);
            ApiPostResponse objDataObject = new ApiPostResponse();

            try
            {
                sqldatenul = System.Data.SqlTypes.SqlDateTime.Null;
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "usp_SaveUpdateTractorUsersDetail";

                command.Parameters.AddWithValue("@FarmerName", FarmerName);
                command.Parameters.AddWithValue("@StateId", StateId);
                command.Parameters.AddWithValue("@MobileNo", MobileNo);
                command.Parameters.AddWithValue("@CategoryId", CategoryId);
                command.Parameters.AddWithValue("@BzProductId", BzProductId);
                command.Parameters.AddWithValue("@ModelNo", ModelNo);
                command.Parameters.AddWithValue("@QuotationPrice", QuotationPrice);
                command.Parameters.AddWithValue("@RequestSource", RequestSource);
                if (string.IsNullOrEmpty(DemoDate))
                {
                    command.Parameters.AddWithValue("@DemoDate", sqldatenul);
                }
                else
                {
                    command.Parameters.AddWithValue("@DemoDate", Convert.ToDateTime(DemoDate));
                }
                command.Parameters.AddWithValue("@TimeSlot", TimeSlot);


                Msg = Convert.ToString(command.ExecuteScalar());
                if (Msg != "")
                {
                    objDataObject.Success = true;
                    objDataObject.Msg     = Msg;
                }
                else
                {
                    objDataObject.Success = false;
                    objDataObject.Msg     = "Issue Occurred, Please try again!!";
                }
                command.Parameters.Clear();

                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }

            connection.Close();
            return(objDataObject);
        }
Exemplo n.º 18
0
        public int OrderCreate(int userid, int FarmerId, string FarmerName, string FatherName, long Mobile, int StateId, int DistrictId, int BlockId,
                               int VillageId, string OtherVillageName, string Address, string DeliveryDate, string Lat, string Long, string ModeOfPayment)//, DataTable DT
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            int           flag    = 0;

            //string flag = "";

            connection = new SqlConnection(connetionString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_VideoOrderCreate";

                command.Parameters.AddWithValue("@CreatedBy", userid);
                command.Parameters.AddWithValue("@farmerid", FarmerId);
                command.Parameters.AddWithValue("@name", FarmerName);
                command.Parameters.AddWithValue("@fathername", FatherName);
                command.Parameters.AddWithValue("@mobile", Mobile);
                command.Parameters.AddWithValue("@stateid", StateId);
                command.Parameters.AddWithValue("@districtid", DistrictId);
                command.Parameters.AddWithValue("@blockid", BlockId);
                command.Parameters.AddWithValue("@villageid", VillageId);
                command.Parameters.AddWithValue("@othervillagename", OtherVillageName);
                command.Parameters.AddWithValue("@Address", Address);
                command.Parameters.AddWithValue("@DeliveryDate", DeliveryDate);
                command.Parameters.AddWithValue("@ModeOfPayment", ModeOfPayment);
                command.Parameters.AddWithValue("@Lat", Lat);
                command.Parameters.AddWithValue("@Long", Long);
                command.Parameters.AddWithValue("@OrderSource", "Video App");
                //  command.Parameters.AddWithValue("@Product", DT);

                SqlParameter Error = new SqlParameter();
                Error.ParameterName = "@Error";
                Error.DbType        = DbType.Int32;
                Error.Direction     = ParameterDirection.Output;
                command.Parameters.Add(Error);


                flag = command.ExecuteNonQuery();
                if (flag > 0)
                {
                    string GetError = command.Parameters["@Error"].Value.ToString();
                    flag = int.Parse(GetError);
                }
                command.Parameters.Clear();
                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, userid); }

            connection.Close();
            return(flag);
        }
Exemplo n.º 19
0
        public DataSet GetSearchProducts(bool IsActive, int CatId, int SubCatId, int ComnyId, int BrandId, int stateID, int DistrictId, int CropId, int blockID, string technicalName, int cropID, string searh, int pageNo, int pageSize, string sortColumn, string sortColumnDir)
        {
            var            TotaRecords = 0;
            SqlConnection  connection;
            SqlDataAdapter adapter;
            SqlCommand     command = new SqlCommand();
            DataSet        ds      = new DataSet();

            connection = new SqlConnection(connetionString);
            try
            {
                DataTable Dt = new DataTable();
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "uspGetProductLIst";
                command.Parameters.AddWithValue("@IsActive", IsActive);
                command.Parameters.AddWithValue("@CategoryID", CatId);
                command.Parameters.AddWithValue("@SubCategoryID", SubCatId);
                command.Parameters.AddWithValue("@CompanyID", ComnyId);
                command.Parameters.AddWithValue("@BrandID", BrandId);
                command.Parameters.AddWithValue("@StateID", stateID);
                command.Parameters.AddWithValue("@DistrictID", DistrictId);
                command.Parameters.AddWithValue("@BlockID", blockID);
                command.Parameters.AddWithValue("@TechnicalName", technicalName);
                command.Parameters.AddWithValue("@CropID", cropID);
                command.Parameters.AddWithValue("@search", searh);
                command.Parameters.AddWithValue("@pageNo", pageNo);
                command.Parameters.AddWithValue("@pageSize", pageSize);
                command.Parameters.AddWithValue("@sortColumn", sortColumn);
                command.Parameters.AddWithValue("@sortColumnDir", sortColumnDir);


                //SqlParameter Error = new SqlParameter();
                //Error.ParameterName = "@totolRecords";
                //Error.DbType = DbType.Int32;
                //Error.Direction = ParameterDirection.Output;
                //Error.Value=
                //command.Parameters.Add(TotaRecords);
                var p = new SqlParameter("@totolRecords", SqlDbType.Int)
                {
                    Value = TotaRecords
                };
                command.Parameters.Add(p);

                adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }


            connection.Close();
            return(ds);
        }
Exemplo n.º 20
0
        public int VideoFarmerDataCollect(int userid, string RefSource, string Fname, string Lname, string fathername, string mobile, int stateid, int districtid, int blockid,
                                          int villageid, string NearByVillage, string Address)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            int           flag    = 0;

            //int flag = "SUCCESS";

            connection = new SqlConnection(connetionString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_FarmerDataCollect_Insert";

                command.Parameters.AddWithValue("@CreatedBy", userid);
                command.Parameters.AddWithValue("@RefSource", RefSource);
                command.Parameters.AddWithValue("@Fname", Fname);
                command.Parameters.AddWithValue("@Lname", Lname);
                command.Parameters.AddWithValue("@fathername", fathername);
                command.Parameters.AddWithValue("@mobile", mobile);
                command.Parameters.AddWithValue("@stateid", stateid);
                command.Parameters.AddWithValue("@districtid", districtid);
                command.Parameters.AddWithValue("@blockid", blockid);
                command.Parameters.AddWithValue("@villageid", villageid);
                command.Parameters.AddWithValue("@NearByVillage", NearByVillage);
                command.Parameters.AddWithValue("@Address", Address);

                SqlParameter returnParameter = command.Parameters.Add("RetVal", SqlDbType.Int);
                returnParameter.Direction = ParameterDirection.ReturnValue;


                var data = command.ExecuteNonQuery();

                flag = int.Parse(data.ToString());
                flag = (int)returnParameter.Value;

                command.Parameters.Clear();
            }
            catch (Exception ex)
            {
                flag = 0;
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, userid);
            }


            connection.Close();
            return(flag);
        }
Exemplo n.º 21
0
        public int Add_Nutrient_value(List <NutrientValue> nval, int subcategoryid, bool Ismaster = true, int productid = 0)
        {
            var dt = new DataTable();

            dt.Columns.Add("NutrientID", type: typeof(short));
            dt.Columns.Add("Amount", type: typeof(decimal));
            dt.Columns.Add("Unit", type: typeof(byte));

            foreach (var i in nval)
            {
                dt.Rows.Add(i.Nutrient.Id, i.Amount, i.Unit.Id);
            }

            string  sql     = "";
            DataSet ds      = new DataSet();
            int     iResult = 0;
            string  result  = "";

            try
            {
                if (Ismaster)
                {
                    sql = StoredProcedure.Add_NutrientValue_Techname;
                    SqlParameter[] parameters = new SqlParameter[3];
                    parameters[0]           = new SqlParameter("@Tbl_NutrientValue_Type", dt);
                    parameters[1]           = new SqlParameter("@SubCategoryID", subcategoryid);
                    parameters[2]           = new SqlParameter("@result", "");
                    parameters[2].Direction = ParameterDirection.Output;
                    iResult = BaseDal.ExecuteNonQuerywithSP(sql, parameters);
                    result  = Convert.ToString(parameters[2].Value);
                }
                else
                {
                    sql = StoredProcedure.ADD_NUTRIENTVALUE_TECHNAME_Dealer;
                    SqlParameter[] parameters = new SqlParameter[5];
                    parameters[0]           = new SqlParameter("@Tbl_NutrientValue_Type", dt);
                    parameters[1]           = new SqlParameter("@SubCategoryID", subcategoryid);
                    parameters[2]           = new SqlParameter("@status", 0);
                    parameters[3]           = new SqlParameter("@productID", productid);
                    parameters[4]           = new SqlParameter("@result", "");
                    parameters[4].Direction = ParameterDirection.Output;
                    iResult = BaseDal.ExecuteNonQuerywithSP(sql, parameters);
                    result  = Convert.ToString(parameters[4].Value);
                }
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }

            return(iResult);
        }
Exemplo n.º 22
0
        public DataSet Get_Product_Detail_Dealer(int productId)
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.Get_Product_Detail_temp;
                SqlParameter[] parameters = new SqlParameter[1];
                parameters[0] = new SqlParameter("@productid", productId);
                ds            = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }
Exemplo n.º 23
0
        public DataSet Get_Role(int userid)
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.SPGetRole;
                SqlParameter[] parameters = new SqlParameter[1];
                parameters[0] = new SqlParameter("@UserID", userid);
                ds            = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }
Exemplo n.º 24
0
        public SavedProductResult SaveSubDealerProducts(int PackageId, int Quantity, int SubDealerId)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            int           flag    = 0;

            connection = new SqlConnection(connetionString);
            SavedProductResult objDataObject = new SavedProductResult();

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_SaveSubDealerProducts";

                command.Parameters.AddWithValue("@StockId", 0);
                command.Parameters.AddWithValue("@PackageId", PackageId);
                command.Parameters.AddWithValue("@Quantity", Quantity);
                command.Parameters.AddWithValue("@SubDealerId", SubDealerId);


                flag = (int)command.ExecuteScalar();
                if (flag > 0)
                {
                    objDataObject.Status   = 1;
                    objDataObject.StockQty = flag;
                    objDataObject.Msg      = "Products have been added successfully to stock.";
                }
                else
                {
                    objDataObject.Status   = 0;
                    objDataObject.StockQty = 0;
                    objDataObject.Msg      = "Issue Occurred, Please try again!!";
                }
                command.Parameters.Clear();

                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, SubDealerId); }

            connection.Close();
            return(objDataObject);
        }
Exemplo n.º 25
0
        public DataSet Get_Product_Package(int productId, int Ismaster = 0)
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.Get_ProductId_Package;
                SqlParameter[] parameters = new SqlParameter[2];
                parameters[0] = new SqlParameter("@ProductId", productId);
                parameters[1] = new SqlParameter("@IsMaster", Ismaster);
                ds            = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }
Exemplo n.º 26
0
        public int TempOrderCreate(int userid, int FarmerId, DataTable DT)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            int           flag    = 0;

            //string flag = "";

            connection = new SqlConnection(connetionString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Usp_TempVideoOrderCreate";

                command.Parameters.AddWithValue("@CreatedBy", userid);
                command.Parameters.AddWithValue("@farmerid", FarmerId);
                command.Parameters.AddWithValue("@OrderSource", "Video App");
                command.Parameters.AddWithValue("@Product", DT);

                SqlParameter Error = new SqlParameter();
                Error.ParameterName = "@Error";
                Error.DbType        = DbType.Int32;
                Error.Direction     = ParameterDirection.Output;
                command.Parameters.Add(Error);


                flag = command.ExecuteNonQuery();
                if (flag > 0)
                {
                    string GetError = command.Parameters["@Error"].Value.ToString();
                    flag = int.Parse(GetError);
                }
                command.Parameters.Clear();
                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, userid); }

            connection.Close();
            return(flag);
        }
Exemplo n.º 27
0
        public DataSet Get_ProductList_useFor(string mode, string CategoryId)
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.Prod_UseForList;
                SqlParameter[] parameters = new SqlParameter[2];
                parameters[0] = new SqlParameter("@mode", mode);
                parameters[1] = new SqlParameter("@CategoryID", CategoryId);
                ds            = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }
Exemplo n.º 28
0
        public DataSet Get_Nutrient_Unit(string mode = "")
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.Get_Nutrient_Unit;
                SqlParameter[] parameters = new SqlParameter[1];
                parameters[0] = new SqlParameter("@MODE", mode);

                ds = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }
Exemplo n.º 29
0
        public ApiPostResponse SaveTractorUserDetailV2(string FarmerName, int StateId, string MobileNo, int CategoryId, string ModelNo, decimal QuotationPrice)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            string        Msg     = "";

            connection = new SqlConnection(connetionString);
            ApiPostResponse objDataObject = new ApiPostResponse();

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "usp_SaveUpdateTractorUsersDetail_Test";

                command.Parameters.AddWithValue("@FarmerName", FarmerName);
                command.Parameters.AddWithValue("@StateId", StateId);
                command.Parameters.AddWithValue("@MobileNo", MobileNo);
                command.Parameters.AddWithValue("@CategoryId", CategoryId);
                command.Parameters.AddWithValue("@ModelNo", ModelNo);
                command.Parameters.AddWithValue("@QuotationPrice", QuotationPrice);

                Msg = Convert.ToString(command.ExecuteScalar());
                if (Msg != "")
                {
                    objDataObject.Success = true;
                    objDataObject.Msg     = Msg;
                }
                else
                {
                    objDataObject.Success = false;
                    objDataObject.Msg     = "Issue Occurred, Please try again!!";
                }
                command.Parameters.Clear();

                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex) { LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); }

            connection.Close();
            return(objDataObject);
        }
Exemplo n.º 30
0
        public DataSet GetUserid_for_Product(int productid, bool Ismaster = false)
        {
            string  sql = "";
            DataSet ds  = new DataSet();

            try
            {
                sql = StoredProcedure.GetUserid_for_Product;
                SqlParameter[] parameters = new SqlParameter[2];
                parameters[0] = new SqlParameter("@ProductId", productid);
                parameters[1] = new SqlParameter("@mastertable", Ismaster);

                ds = BaseDal.ExecuteAdapter(sql, parameters);
            }
            catch (Exception ex)
            {
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
            }
            return(ds);
        }