예제 #1
0
        public async Task <int> AddCompanyAsync(Company company)
        {
            string sql = string.Format("INSERT INTO [Company] ([Name],[Address],[PhoneNo] ,[FaxNo] ,[EMail] ,[ContactPersonName] ,[WHName] ,[WHAddress] ,[WHPhoneNo] ,[WHEmail]) VALUES ('{0}', '{1}','{2}','{3}', '{4}','{5}','{6}', '{7}','{8}','{9}')",
                                       company.Name.Replace("'", "''"), company.Address.Replace("'", "''"), company.PhoneNo, company.FaxNo, company.EMail.Replace("'", "''"), company.ContactPersonName.Replace("'", "''"), company.WHName.Replace("'", "''"), company.WHAddress.Replace("'", "''"), company.PhoneNo.Replace("'", "''"), company.WHEmail.Replace("'", "''"));

            return(await _sqlHelper.ExecuteNonQueryAsync(ConnectionSettings.ConnectionString, sql, CommandType.Text));
        }
예제 #2
0
        public void AssignHgiUserToOrganizationHierarchy(int organizationId)
        {
            //await Task.Delay(0);
            SqlParameter[] parameters = new SqlParameter[1];

            SqlParameter parameter0 = new SqlParameter("@organizationId", organizationId);

            parameters[0] = parameter0;

            _sqlHelper.ExecuteNonQueryAsync(_connectionStrings.Value.SentinelFmMain, "OrganizationHierarchyAssignHgiUserToTopLevel", CommandType.StoredProcedure, parameters);
        }
예제 #3
0
        public async Task AddSupplierAsync(Supplier supplier)
        {
            string sql = string.Format("INSERT INTO [Supplier] ([CompanyId],[Name],[ContactPersonName],[PhoneNo],[EmailID],[Address],[City],[State],[Country]," +
                                       "[ZIPCode],[FAXNo],[DateFormat],[noofstages],[CompanyProfileID],[PoLetterHead]) VALUES ('{0}', '{1}','{2}','{3}', '{4}','{5}','{6}', '{7}','{8}','{9}','{10}', '{11}','{12}','{13}','{14}')",
                                       supplier.CompanyId, supplier.Name.Replace("'", "''"), supplier.ContactPersonName.Replace("'", "''"), supplier.PhoneNo, supplier.EmailID.Replace("'", "''"), supplier.Address.Replace("'", "''"), supplier.City.Replace("'", "''"), supplier.State.Replace("'", "''"), supplier.Country.Replace("'", "''"),
                                       supplier.ZIPCode.Replace("'", "''"), supplier.FAXNo, supplier.DateFormat, supplier.noofstages, supplier.CompanyProfileID, supplier.PoLetterHead);

            sql = sql + " Select Scope_Identity()";


            var supplierId = _sqlHelper.ExecuteScalar(ConnectionSettings.ConnectionString, sql, CommandType.Text);


            foreach (SupplierTerms term in supplier.Terms)
            {
                sql = string.Format("INSERT INTO [dbo].[supplierterms]([supplierId],[sequenceNo],[terms]) VALUES ('{0}', '{1}','{2}')",
                                    supplierId, term.SequenceNo, term.Terms.Replace("'", "''"));

                await _sqlHelper.ExecuteNonQueryAsync(ConnectionSettings.ConnectionString, sql, CommandType.Text);
            }
        }
예제 #4
0
        public void SetOrganizationHierarchyAssignmentExpireDateTime(int organizationId, DateTime exd)
        {
            SqlParameter[] parameters = new SqlParameter[2];

            SqlParameter parameter0 = new SqlParameter("@OrganizationId", organizationId);

            parameters[0] = parameter0;

            SqlParameter parameter1 = new SqlParameter("@expdt", exd);

            parameters[1] = parameter1;

            _sqlHelper.ExecuteNonQueryAsync(_connectionStrings.Value.SentinelFmMain, "OrganizationHierarchyAssignmentBatchSetExpireDateTime", CommandType.StoredProcedure, parameters);
        }
예제 #5
0
        public async Task AddCustomerAsync(Customer customer)
        {
            if (customer.Name == null)
            {
                customer.Name = string.Empty;
            }
            if (customer.AddressLine1 == null)
            {
                customer.AddressLine1 = string.Empty;
            }
            if (customer.City == null)
            {
                customer.City = string.Empty;
            }
            if (customer.State == null)
            {
                customer.State = string.Empty;
            }
            if (customer.ZIPCode == null)
            {
                customer.ZIPCode = string.Empty;
            }
            if (customer.ContactPersonName == null)
            {
                customer.ContactPersonName = string.Empty;
            }
            if (customer.TelephoneNumber == null)
            {
                customer.TelephoneNumber = string.Empty;
            }
            if (customer.FaxNumber == null)
            {
                customer.FaxNumber = string.Empty;
            }
            if (customer.EmailAddress == null)
            {
                customer.EmailAddress = string.Empty;
            }
            if (customer.TruckType == null)
            {
                customer.TruckType = string.Empty;
            }
            if (customer.CollectFreight == null)
            {
                customer.CollectFreight = string.Empty;
            }
            if (customer.Comments == null)
            {
                customer.Comments = string.Empty;
            }
            if (customer.FOB == null)
            {
                customer.FOB = string.Empty;
            }
            if (customer.Terms == null)
            {
                customer.Terms = string.Empty;
            }
            if (customer.ShipVia == null)
            {
                customer.ShipVia = string.Empty;
            }
            if (customer.EndCustomerName == null)
            {
                customer.EndCustomerName = string.Empty;
            }
            if (customer.Billing == null)
            {
                customer.Billing = string.Empty;
            }


            string sql = string.Format($"INSERT INTO [dbo].[customer] ([CompanyId],[Name],[AddressLine1],[City],[State],[ZIPCode],[ContactPersonName],[TelephoneNumber],[FaxNumber],[EmailAddress],[TruckType],[CollectFreight],[Comments],[Surcharge],[FOB],[Terms],[RePackingCharge],[ShipVia],[invoicingtypeid],[endcustomername],[DisplayLineNo],[Billing],[RePackingPoNo])  VALUES ('{customer.CompanyId}', " +
                                       $"'{customer.Name.Replace("'", "''")}', '{customer.AddressLine1.Replace("'", "''")}', '{customer.City.Replace("'", "''")}', '{customer.State.Replace("'", "''")}', '{customer.ZIPCode.Replace("'", "''")}', '{customer.ContactPersonName.Replace("'", "''")}', '{customer.TelephoneNumber.Replace("'", "''")}',     " +
                                       $"'{customer.FaxNumber.Replace("'", "''")}', '{customer.EmailAddress.Replace("'", "''")}', '{customer.TruckType.Replace("'", "''")}', '{customer.CollectFreight.Replace("'", "''")}', " +
                                       $"'{customer.Comments.Replace("'", "''")}', '{customer.Surcharge}', '{customer.FOB.Replace("'", "''")}', '{customer.Terms.Replace("'", "''")}',  '{customer.RePackingCharge}', " +
                                       $"'{customer.ShipVia.Replace("'", "''")}', '{1}', '{customer.EndCustomerName.Replace("'", "''")}','{ customer.DisplayLineNo}','{ customer.Billing.Replace("'", "''")}','{ string.Empty}')");

            sql = sql + " Select Scope_Identity()";


            var customerId = _sqlHelper.ExecuteScalar(ConnectionSettings.ConnectionString, sql, CommandType.Text);


            foreach (CustomerShippingInfo term in customer.ShippingInfos)
            {
                if (term.Name == null)
                {
                    term.Name = string.Empty;
                }
                if (term.ContactPersonName == null)
                {
                    term.ContactPersonName = string.Empty;
                }
                if (term.AddressLine1 == null)
                {
                    term.AddressLine1 = string.Empty;
                }
                if (term.City == null)
                {
                    term.City = string.Empty;
                }
                if (term.State == null)
                {
                    term.State = string.Empty;
                }
                if (term.ZIPCode == null)
                {
                    term.ZIPCode = string.Empty;
                }


                sql = string.Format($"INSERT INTO [dbo].[customershippinginfo] ([CustomerID] ,[Name] ,[ContactPersonName] ,[AddressLine1] ,[City] ,[State],[ZIPCode],[IsDefault],[IsOld]) VALUES ( " +
                                    $"'{customerId}' , '{term.Name.Replace("'", "''")}' , '{term.ContactPersonName.Replace("'", "''")}' ,'{term.AddressLine1.Replace("'", "''")}', '{term.City.Replace("'", "''")}' , '{term.State.Replace("'", "''")}' , '{term.ZIPCode.Replace("'", "''")}' , '{term.IsDefault}','{false}')");

                await _sqlHelper.ExecuteNonQueryAsync(ConnectionSettings.ConnectionString, sql, CommandType.Text);
            }
        }