Пример #1
0
        private void btnOk_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (dtExcelData == null)
            {
                return;
            }
            if (CheckColumns() == false)
            {
                return;
            }
            string sVendorName = "";
            string sVAddress   = "";
            string sContactNo  = "";
            string sEmail      = "";
            string sCSTNo      = "";
            string sTNGSTNo    = "";
            string sTIN        = "";
            string sPAN        = "";
            int    iSupply     = 0;
            int    iContract   = 0;
            int    iService    = 0;

            for (int i = 0; i < dtExcelData.Rows.Count; i++)
            {
                sVendorName = dtExcelData.Rows[i]["VendorName"].ToString();
                if (VendorBL.IsValidName(sVendorName) == true && sVendorName != "")
                {
                    sVAddress  = dtExcelData.Rows[i]["Address"].ToString();
                    sContactNo = dtExcelData.Rows[i]["ContactNo"].ToString();
                    sEmail     = dtExcelData.Rows[i]["EmailId"].ToString();
                    sCSTNo     = dtExcelData.Rows[i]["CSTNo"].ToString();
                    sTNGSTNo   = dtExcelData.Rows[i]["TNGST"].ToString();
                    sTIN       = dtExcelData.Rows[i]["TIN"].ToString();
                    sPAN       = dtExcelData.Rows[i]["PAN"].ToString();
                    iSupply    = Convert.ToInt32(clsStatic.IsNullCheck(dtExcelData.Rows[i]["Supply"].ToString(), clsStatic.datatypes.vartypenumeric));
                    iContract  = Convert.ToInt32(clsStatic.IsNullCheck(dtExcelData.Rows[i]["Contract"].ToString(), clsStatic.datatypes.vartypenumeric));
                    iService   = Convert.ToInt32(clsStatic.IsNullCheck(dtExcelData.Rows[i]["Service"].ToString(), clsStatic.datatypes.vartypenumeric));
                    VendorBL.ImportTransaction(sVendorName, sVAddress, sContactNo, sEmail, sCSTNo, sTNGSTNo, sTIN, sPAN, iSupply, iContract, iService);
                }
            }

            if (BsfGlobal.g_bFADB == true)
            {
                BsfGlobal.RefreshSubLedger(1);
            }
            MessageBox.Show("Imported Successfully!", "Vendor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Clear();
        }
Пример #2
0
        public int InsertVendorMaster(Vendor.BusinessLayer.VendorBL argVendor)
        {
            SqlConnection conn;

            conn = new SqlConnection();
            conn = BsfGlobal.OpenVendorAnalDB();
            SqlTransaction tran = conn.BeginTransaction();
            int            iCId = 0;

            try
            {
                SqlCommand Command = new SqlCommand("Insert_VendorMaster", conn, tran);
                Command.CommandType = CommandType.StoredProcedure;
                Command.Parameters.Clear();
                Command.Parameters.AddWithValue("@VendorId", argVendor.VendorId);
                Command.Parameters["@VendorId"].Direction = ParameterDirection.Output;
                Command.Parameters.AddWithValue("@VendorName", argVendor.VendorName);
                Command.Parameters.AddWithValue("@Supply", argVendor.Supply);
                Command.Parameters.AddWithValue("@Contract", argVendor.Contract);
                Command.Parameters.AddWithValue("@Service", argVendor.Service);
                Command.Parameters.AddWithValue("@Address", argVendor.RegAddress);
                Command.Parameters.AddWithValue("@CityId", argVendor.CityId);
                Command.Parameters.AddWithValue("@Pin", argVendor.PinNo);
                Command.Parameters.AddWithValue("@STypeId", argVendor.STypeId);
                Command.Parameters.AddWithValue("@Company", argVendor.iCompany);
                Command.Parameters.AddWithValue("@SuppTypeId", argVendor.SuppTypeId);
                Command.Parameters.AddWithValue("@ChequeNo", argVendor.ChequeNo);
                Command.Parameters.AddWithValue("@Code", argVendor.Code);
                Command.ExecuteNonQuery();
                iCId = (int)Command.Parameters["@VendorId"].Value;
                tran.Commit();
                if (BsfGlobal.g_bVendorDB == true)
                {
                    BsfGlobal.RefreshSubLedger(1);
                }
            }
            catch
            {
                tran.Rollback();
            }
            finally
            {
                conn.Close();
            }
            return(iCId);
        }