public static Int32 AddNewVendor(Vendor vendor)
 {
     int isFlag = 0;
     Common objCommon = new Common();
     VendorManagementBLL objVendorManagementBLL = null;
     try
     {
         objVendorManagementBLL = new VendorManagementBLL();
         vendor.CreatedBy = objCommon.GetCurrentUserName();
         isFlag=objVendorManagementBLL.InsertVendor(vendor);
     }
     catch (Exception ex)
     {
         // Log the error to a text file in the Error folder
         Common.WriteError(ex);
     }
     finally
     {
         objVendorManagementBLL = null;
     }
     return isFlag;
 }
        /// <summary>
        /// Method to make modification in vendor
        /// </summary>
        /// <param name="vendor"></param>
        /// <returns></returns>
        public Int32 UpdateVendor(Vendor vendor)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();
            SqlParameter[] oPara =
            {
                new SqlParameter("@VendorID", SqlDbType.Int),
                new SqlParameter("@VendorName", SqlDbType.VarChar),
                new SqlParameter("@Address", SqlDbType.VarChar),
                new SqlParameter("@City", SqlDbType.VarChar),
                new SqlParameter("@EmpanelDate",SqlDbType.VarChar),
                new SqlParameter("@DCID", SqlDbType.Int),
                new SqlParameter("Comment",SqlDbType.VarChar),
                new SqlParameter("ModifiedBy",SqlDbType.VarChar),
                new SqlParameter("@Rval", SqlDbType.Int)
            };
            oPara[0].Value = vendor.VendorID;
            oPara[0].Size = 155;
            oPara[1].Value = vendor.VendorName.Trim();
            oPara[1].Size = 155;
            oPara[2].Value = vendor.Address;
            oPara[2].Size = 255;
            oPara[3].Value = vendor.City;
            oPara[3].Size=255;
            oPara[4].Value = vendor.EmpanelDate;
            oPara[4].Size = 255;
            oPara[5].Value = vendor.DCID;
            oPara[5].Size = 255;
            oPara[6].Value = vendor.Comment;
            oPara[6].Size = 255;
            oPara[7].Value = vendor.ModifiedBy;
            oPara[7].Size = 255;

            oPara[8].Direction = ParameterDirection.ReturnValue;
            ObjSqlHelper.ExecNonQueryProc(ConstantsDLL.USP_UPDATEVENDOR, oPara);
            return Convert.ToInt32(oPara[8].Value);
        }
        /// <summary>
        /// Method to insert the details for creating new vendor
        /// </summary>
        /// <param name="vendor"></param>
        /// <returns></returns>
        public int InsertVendor(Vendor vendor)
        {
            //string proc_name = ConstantsDLL.USP_INSERTVENDOR;
            ObjSqlHelper = new SqlHelper.SqlHelper();
            SqlParameter[] param =
            {
             new SqlParameter("@VendorName",SqlDbType.VarChar),
             new SqlParameter("@Address",SqlDbType.VarChar),
             new SqlParameter("@City", SqlDbType.VarChar),
             new SqlParameter("@EmpanelDate",SqlDbType.Date),
             new SqlParameter("@DCID", SqlDbType.Int),
             new SqlParameter("@Comment",SqlDbType.VarChar),
             new SqlParameter("@CreatedBy",SqlDbType.VarChar),
             new SqlParameter("@rVal",SqlDbType.Int)
            };
            param[0].Value = vendor.VendorName;
            param[0].Size = 255;
            param[1].Value = vendor.Address;
            param[1].Size = 155;
            param[2].Value = vendor.City;
            param[2].Size = 255;
            param[3].Value = vendor.EmpanelDate;
            param[3].Size = 255;
            param[4].Value = vendor.DCID;
            param[4].Size = 155;
            param[5].Value = vendor.Comment;
            param[5].Size = 255;
            param[6].Value = vendor.CreatedBy;
            param[6].Size = 255;
            param[7].Direction = ParameterDirection.ReturnValue;

            ObjSqlHelper.ExecNonQueryProc(ConstantsDLL.USP_INSERTVENDOR, param);
            //using (SqlHelper.SqlHelper db = new SqlHelper.SqlHelper())
            //{
            //    db.ExecNonQueryProc(proc_name, param);
            //}
            //return true;
            return Convert.ToInt32(param[7].Value);
        }
 /// <summary>
 /// to update details in vendor
 /// </summary>
 /// <param name="vendor"></param>
 /// <returns></returns>
 public Int32 UpdateVendor(Vendor vendor)
 {
     Int32 isFlag = 0;
     try
     {
         using (VendorManagementDLL vendorManagementDLL = new VendorManagementDLL())
         {
             isFlag = vendorManagementDLL.UpdateVendor(vendor);
         }
         return isFlag;
     }
     catch
     {
         throw;
     }
 }
 /// <summary>
 /// To insert a new vendor
 /// </summary>
 /// <param name="vendor"></param>
 /// <returns></returns>
 public Int32 InsertVendor(Vendor vendor)
 {
     int isFlag = 0;
     try
     {
         using (VendorManagementDLL vendorManagementDLL = new VendorManagementDLL())
         {
             isFlag = vendorManagementDLL.InsertVendor(vendor);
         }
         return isFlag;
     }
     catch
     {
         throw;
     }
 }