protected void Save(object sender, EventArgs e)
        {
            string oldName = ddlFind.SelectedValue;
            string newName = string.Format("#{0}", ddlDictionary.SelectedValue);

            if (!string.IsNullOrEmpty(oldName))
            {
                string sql = @"
                            UPDATE
                                [cmsPropertyType]
                            SET
                                [Name] = @NewName
                            WHERE
                                [Name] = @OldName
                ";

                ISqlHelper helper       = umbraco.BusinessLogic.Application.SqlHelper;
                int        rowsAffected = helper.ExecuteNonQuery(sql,
                                                                 new[]
                {
                    helper.CreateParameter("@NewName", newName),
                    helper.CreateParameter("@OldName", oldName)
                });
                ltrRowsAffected.Text = rowsAffected.ToString();
                SetupPropertyNames();
            }
        }
Exemple #2
0
        public (bool MsgCode, string MsgName) InsertInvestmentTrust(string NO, string NAME, string IDNO)
        {
            string SQLQuery = " SELECT * FROM AMD..tblInvestmentTrust WHERE NO = @NO ";
            var    p        = new DynamicParameters();

            p.Add("@NO", NO);
            ISqlHelper sqlHelper = SQLHelper.GetInstance("Dapper", Configurations.AMDConnectionString);
            dynamic    result    = sqlHelper.Query <dynamic>(SQLQuery.ToString(), 1, (dynamic)p);

            sqlHelper.Close();
            if (((IEnumerable <dynamic>)result).AsList().Count > 0)
            {
                return(false, "失敗(己存在重覆編號資料)");
            }

            string SQL = "INSERT INTO AMD..tblInvestmentTrust VALUES (@NO, @NAME, @IDNO)";

            p = new DynamicParameters();
            p.Add("@NO", NO);
            p.Add("@NAME", NAME);
            p.Add("@IDNO", IDNO);

            sqlHelper = SQLHelper.GetInstance("Dapper", Configurations.AMDConnectionString);

            sqlHelper.Open();
            result = sqlHelper.ExecuteNonQuery(SQL, 1, (dynamic)p);
            sqlHelper.Close();

            return(((bool)result) ? (true, "成功") : (false, "失敗"));
        }
Exemple #3
0
        /// <summary>
        /// 注销数据
        /// </summary>
        /// <param name="briId"></param>
        /// <param name="isCancel">0 or 1</param>
        /// <returns></returns>
        public static int Cancel(String briId, int isCancel)
        {
            String     sqlCon     = string.Format("UPDATE mdtbl_bridge_xzsb  SET  is_cancel ='{0}' WHERE bri_id = '{1}'", briId, isCancel);
            ISqlHelper sql_helper = SqlHelperFactory.GetDefaultSqlHelper();

            return(sql_helper.ExecuteNonQuery(sqlCon));
        }
Exemple #4
0
        public async Task UpdateSupplierAsync(Supplier supplier)
        {
            try
            {
                var sql = string.Format("DELETE FROM [dbo].[supplierterms]  WHERE supplierid = '{0}'", supplier.Id);

                _sqlHelper.ExecuteNonQuery(ConnectionSettings.ConnectionString, sql, CommandType.Text);

                //sql = "UPDATE [dbo].[Supplier] SET [CompanyId] = '{0}',[Name]= '{1}',[ContactPersonName]= '{2}',[PhoneNo]= '{3}',[EmailID]= '{4}',[Address]= '{5}',[City]= '{6}',[State]= '{7}',[Country]= '{8}',[ZIPCode]= '{9}',[FAXNo]= '{10}',[DateFormat]= '{11}',[noofstages]= '{12}',[CompanyProfileID] = '{13}'  WHERE id = '{14}'";

                sql = string.Format($"UPDATE [dbo].[Supplier] SET [CompanyId] = '{supplier.CompanyId}',[Name]= '{supplier.Name.Replace("'", "''")}',[ContactPersonName]= '{supplier.ContactPersonName.Replace("'", "''")}',[PhoneNo]= '{supplier.PhoneNo.Replace("'", "''")}',[EmailID]= '{supplier.EmailID.Replace("'", "''")}',[Address]= '{supplier.Address.Replace("'", "''")}',[City]= '{supplier.City.Replace("'", "''")}'," +
                                    $"[State]= '{supplier.State.Replace("'", "''")}',[Country]= '{supplier.Country.Replace("'", "''")}',[ZIPCode]= '{supplier.ZIPCode.Replace("'", "''")}',[FAXNo]= '{supplier.FAXNo}',[DateFormat]= '{supplier.DateFormat}',[noofstages]= '{supplier.noofstages}',[CompanyProfileID] = '{supplier.CompanyProfileID}',[PoLetterHead]= '{supplier.PoLetterHead}'  WHERE id = '{supplier.Id}' ");
                await _sqlHelper.ExecuteNonQueryAsync(ConnectionSettings.ConnectionString, sql, CommandType.Text);

                foreach (SupplierTerms term in supplier.Terms)
                {
                    sql = string.Format($"INSERT INTO [dbo].[supplierterms] ([supplierId],[sequenceNo],[terms]) VALUES ('{supplier.Id}', '{term.SequenceNo}','{term.Terms.Replace("'", "''")}')");
                    await _sqlHelper.ExecuteNonQueryAsync(ConnectionSettings.ConnectionString, sql, CommandType.Text);
                }
            }
            catch (Exception ex)
            {
                var error = ex.Message;
            }
        }
Exemple #5
0
        /// <summary>
        /// Deletes this instance.
        /// </summary>
        public virtual void delete()
        {
            DeleteEventArgs e = new DeleteEventArgs();

            FireBeforeDelete(e);
            if (!e.Cancel)
            {
                // remove relations
                var rels = Relations;
                foreach (relation.Relation rel in rels)
                {
                    rel.Delete();
                }

                //removes tasks
                foreach (Task t in Tasks)
                {
                    t.Delete();
                }

                //remove notifications
                Notification.DeleteNotifications(this);

                //remove permissions
                Permission.DeletePermissions(this);

                //removes tag associations (i know the key is set to cascade but do it anyways)
                Tag.RemoveTagsFromNode(this.Id);

                SqlHelper.ExecuteNonQuery("DELETE FROM umbracoNode WHERE uniqueID= @uniqueId", SqlHelper.CreateParameter("@uniqueId", _uniqueID));
                FireAfterDelete(e);
            }
        }
Exemple #6
0
        /// <summary>
        /// Creates a new language given the culture code - ie. da-dk  (denmark)
        /// </summary>
        /// <param name="cultureCode">Culturecode of the language</param>
        public static void MakeNew(string cultureCode)
        {
            lock (Locker)
            {
                var culture = GetCulture(cultureCode);
                if (culture != null)
                {
                    //insert it
                    SqlHelper.ExecuteNonQuery(
                        "insert into umbracoLanguage (languageISOCode) values (@CultureCode)",
                        SqlHelper.CreateParameter("@CultureCode", cultureCode));

                    InvalidateCache();

                    //get it's id
                    var newId = SqlHelper.ExecuteScalar <int>("SELECT MAX(id) FROM umbracoLanguage WHERE languageISOCode=@cultureCode", SqlHelper.CreateParameter("@cultureCode", cultureCode));

                    //load it and raise events
                    using (var dr = SqlHelper.ExecuteReader(string.Format("{0} where id = {1}", m_SQLOptimizedGetAll, newId)))
                    {
                        while (dr.Read())
                        {
                            var ct = new Language();
                            ct.PopulateFromReader(dr);
                            ct.OnNew(new NewEventArgs());
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Executes a command and returns the number of rows affected.
 /// </summary>
 /// <param name="commandText">The command text.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>
 /// The number of rows affected by the command.
 /// </returns>
 public int ExecuteNonQuery(string commandText, params IParameter[] parameters)
 {
     foreach (ISqlHelperExtension extension in m_Extensions)
     {
         extension.OnExecuteNonQuery(m_SqlHelper, ref commandText, ref parameters);
     }
     return(m_SqlHelper.ExecuteNonQuery(commandText, parameters));
 }
Exemple #8
0
        /// <summary>
        /// 修改指定子桥梁信息
        /// </summary>
        /// <param name="bc"></param>
        /// <returns></returns>
        public static int UpdateChildBridge(ChildBridge child)
        {
            String sql = string.Format("UPDATE mdtbl_bridge_children  SET  bri_id ='{0}', type_id = '{1}' , bridge_children_name = '{2}', bridge_children_discribe = '{3}', bridge_pile = '{4}' WHERE bridge_children_id = '{5}'",
                                       child.ParentId, child.TypeId, child.Name, child.Description, child.PileId, child.Id);
            ISqlHelper sql_helper = SqlHelperFactory.GetDefaultSqlHelper();

            return(sql_helper.ExecuteNonQuery(sql));
        }
Exemple #9
0
        public int AddProject(Project p)
        {
            String sql = string.Format("INSERT INTO mdtbl_project(prj_id,  prj_name, begintime, endtime, prj_describe, prj_contract, prj_man, prj_status) VALUES" +
                                       "('{0}','{1}','{2}','{3}','{4}', '{5}', '{6}', {7})",
                                       p.Id, p.Name, p.BeginTime.ToString("yyyy-MM-dd HH:mm:ss"), p.EndTime.ToString("yyyy-MM-dd HH:mm:ss"), p.Description, p.ContractNumber, p.Creator, p.Status);
            ISqlHelper sql_helper = SqlHelperFactory.GetDefaultSqlHelper();

            return(sql_helper.ExecuteNonQuery(sql));
        }
Exemple #10
0
        public void LogInfo(GenericSchedulesLog genericSchedulesLog)
        {
            //genericSchedulesLog.LogDateTime = DateTime.UtcNow;
            genericSchedulesLog.Log             = genericSchedulesLog.Log.Replace("'", "");
            genericSchedulesLog.GenericDateTime = genericSchedulesLog.GenericScheduleDateTime.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            string sql = "INSERT INTO [vlfGenericSchedulesLog] ([GenericScheduleID]  ,[OrganizationID] ,[GenericScheduleDateTime] ,[LogDateTime],[LogType],[Log]) VALUES ('" + genericSchedulesLog.GenericScheduleId + "', '" + genericSchedulesLog.OrganizationId + "','" + genericSchedulesLog.GenericDateTime + "','" + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture) + "', '" + genericSchedulesLog.LogType + "','" + genericSchedulesLog.Log + "')";

            Int32 rows = _sqlHelper.ExecuteNonQuery(_connectionStrings.Value.SentinelFmMain, sql, CommandType.Text);
        }
Exemple #11
0
        public static PreValue MakeNew(int dataTypeDefId, string value)
        {
            SqlHelper.ExecuteNonQuery(
                "insert into cmsDataTypePreValues (datatypenodeid,[value],sortorder,alias) values (@dtdefid,@value,0,'')",
                SqlHelper.CreateParameter("@dtdefid", dataTypeDefId),
                SqlHelper.CreateParameter("@value", value));
            var id = SqlHelper.ExecuteScalar <int>("SELECT MAX(id) FROM cmsDataTypePreValues");

            return(new PreValue(id));
        }
Exemple #12
0
        /// <summary>
        /// 新建桥梁行政识别数据
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        public static int AddBridgeXzsb(Bridge x)
        {
            String sqlCon = string.Format("INSERT INTO mdtbl_bridge_xzsb(bri_id ,bri_code,bri_name,bri_pic_name,bri_xzsb_number,bri_xzsb_name,bri_xzsb_level,bri_xzsb_pile,bri_xzsb_funtype,bri_xzsb_downchannel,bri_xzsb_downpile , bri_xzsb_designload, bri_xzsb_goload, bri_xzsb_slopelend, bri_xzsb_pavement, bri_xzsb_unit, bri_xzsb_date, is_cancel, prj_id) " +
                                          "VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{19}')",
                                          x.Id, x.Code, x.Name, x.PictureName, x.XzsbNumber, x.XzsbName, x.XzsbLevel, x.XzsbPile,
                                          x.XzsbFuntype, x.XzsbDownchannel, x.XzsbDownpile, x.XzsbDesignload, x.XzsbGoload,
                                          x.XzsbSlopelend, x.XzsbPavement, x.XzsbUnit, x.XzsbDate, x.IsCancel, x.ProjectId);
            ISqlHelper sql_helper = SqlHelperFactory.GetDefaultSqlHelper();

            return(sql_helper.ExecuteNonQuery(sqlCon));
        }
Exemple #13
0
        /// <summary>
        /// 添加一个子桥梁
        /// </summary>
        /// <param name="bc"></param>
        /// <returns></returns>
        public static int AddChildBridge(ChildBridge child)
        {
            String sql = string.Format("INSERT INTO mdtbl_bridge_children(bridge_children_id,bri_id," +
                                       "type_id,bridge_children_name,bridge_children_discribe,bridge_pile) " +
                                       "VALUES('{0}','{1}','{2}','{3}','{4}', '{5}')",
                                       child.Id, child.ParentId, child.TypeId, child.Name,
                                       child.Description, child.PileId);
            ISqlHelper sql_helper = SqlHelperFactory.GetDefaultSqlHelper();

            return(sql_helper.ExecuteNonQuery(sql));
        }
Exemple #14
0
        /// <summary>
        /// 修改桥梁行政识别数据
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        public static int UpdateBridgeXzsb(Bridge x)
        {
            String sqlCon = string.Format("UPDATE mdtbl_bridge_xzsb   SET bri_code = '{0}' , bri_name = '{1}' , bri_pic_name = '{2}' , bri_xzsb_number = '{3}', bri_xzsb_name = '{4}', bri_xzsb_level = '{5}' ," +
                                          " bri_xzsb_pile = '{6}', bri_xzsb_funtype = '{7}', bri_xzsb_downchannel = '{8}', bri_xzsb_downpile = '{9}', bri_xzsb_designload = '{10}', bri_xzsb_goload = '{11}', bri_xzsb_slopelend = '{12}'," +
                                          "bri_xzsb_pavement = '{13}' , bri_xzsb_unit = '{14}' , bri_xzsb_date = '{15}' , is_cancel = '{16}', prj_id = '{17}'  WHERE bri_id = '{18}'",
                                          x.Code, x.Name, x.PictureName, x.XzsbNumber, x.XzsbName, x.XzsbLevel, x.XzsbPile, x.XzsbFuntype,
                                          x.XzsbDownchannel, x.XzsbDownpile, x.XzsbDesignload, x.XzsbGoload, x.XzsbSlopelend,
                                          x.XzsbPavement, x.XzsbUnit, x.XzsbDate, x.IsCancel, x.ProjectId, x.Id);
            ISqlHelper sql_helper = SqlHelperFactory.GetDefaultSqlHelper();

            return(sql_helper.ExecuteNonQuery(sqlCon));
        }
Exemple #15
0
        public void AssignHgiUserToOrganizationHierarchy(int organizationId)
        {
            //await Task.Delay(0);
            SqlParameter[] parameters = new SqlParameter[1];

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

            parameters[0] = parameter0;

            Int32 rows = _sqlHelper.ExecuteNonQuery(_connectionStrings.Value.SentinelFmMain, "OrganizationHierarchyAssignHgiUserToTopLevel", CommandType.StoredProcedure, parameters);
        }
        /// <summary>
        /// Wrapper around umbraco's sqlHelper.ExecuteNonQuery that handles a few exceptions
        /// </summary>
        /// <param name="query">The SQL Query to execute</param>
        /// <param name="parameters">Dictionary mapping parameter name to parameter value</param>
        /// <returns>The number of rows affected, or -1 on failure</returns>
        private static int?NonQuery(string query, Dictionary <string, object> parameters)
        {
            int?       numRows;
            ISqlHelper sqlHelper = null;

            try
            {
                sqlHelper = DataLayerHelper.CreateSqlHelper(global::Umbraco.Core.ApplicationContext.Current.DatabaseContext.ConnectionString);
                var numParams = parameters.Count;
                if (numParams < 1)
                {
                    numRows = sqlHelper.ExecuteNonQuery(query);
                }
                else
                {
                    var sqlParameters = new IParameter[numParams];
                    var i             = 0;
                    foreach (var parameter in parameters)
                    {
                        sqlParameters[i++] = sqlHelper.CreateParameter(parameter.Key, parameter.Value);
                    }
                    numRows = sqlHelper.ExecuteNonQuery(query, sqlParameters);
                }
            }
            catch (umbraco.UmbracoException ex)
            {
                LogHelper.Error(typeof(DbAccess), "Error In Database Query to fullTextCache.", ex);
                numRows = null;
            }
            finally
            {
                if (sqlHelper != null)
                {
                    sqlHelper.Dispose();
                }
            }
            return(numRows);
        }
Exemple #17
0
        /// <summary>
        /// Creates a new language given the culture code - ie. da-dk  (denmark)
        /// </summary>
        /// <param name="CultureCode">Culturecode of the language</param>
        public static void MakeNew(string CultureCode)
        {
            if (new CultureInfo(CultureCode) != null)
            {
                SqlHelper.ExecuteNonQuery(
                    "insert into umbracoLanguage (languageISOCode) values (@CultureCode)",
                    SqlHelper.CreateParameter("@CultureCode", CultureCode));

                InvalidateCache();

                NewEventArgs e = new NewEventArgs();
                GetByCultureCode(CultureCode).OnNew(e);
            }
        }
 public virtual JArray ExecuteNonQuery(string connection, string command)
 {
     try
     {
         var affectedRow = _sqlHelper.ExecuteNonQuery(connection, command);
         var arrResult   = new int[1];
         arrResult[0] = affectedRow;
         return(JArray.Parse(JsonConvert.SerializeObject(arrResult)));
     }
     catch (SqlException ex)
     {
         throw new KhodkarInvalidException(ex.Message);
     }
 }
Exemple #19
0
        public bool DeleteInvestmentTrust(string NO)
        {
            string SQL = "DELETE FROM AMD..tblInvestmentTrust WHERE NO = @NO";
            var    p   = new DynamicParameters();

            p.Add("@NO", NO);

            ISqlHelper sqlHelper = SQLHelper.GetInstance("Dapper", Configurations.AMDConnectionString);

            sqlHelper.Open();
            bool result = sqlHelper.ExecuteNonQuery(SQL, 1, (dynamic)p);

            sqlHelper.Close();

            return(result);
        }
Exemple #20
0
        /// <summary>
        /// 不带参数的操作语句
        /// </summary>
        /// <param name="cmdText"></param>
        /// <returns></returns>
        public static List <Dictionary <string, object> > ExecuteNonQuery(string cmdText)
        {
            List <Dictionary <string, object> > resDics = new List <Dictionary <string, object> >();
            var connDics = new ConnectionHelper().GetOrgConnDic();

            foreach (var dic in connDics)
            {
                Dictionary <string, object> resDic = new Dictionary <string, object>();
                resDic["code"] = dic["code"];
                resDic["name"] = dic["name"];

                ISqlHelper sqlHelper = SqlConvertHelper.GetInstallSqlHelper(dic["connectionstring"]);
                resDic["data"] = sqlHelper.ExecuteNonQuery(cmdText);

                resDics.Add(resDic);
            }
            return(resDics);
        }
Exemple #21
0
        /// <summary>
        /// 返回影响的行数
        /// </summary>
        /// <param name="commandType"></param>
        /// <param name="cmdText"></param>
        /// <param name="spr"></param>
        /// <returns></returns>
        public static List <OrganizationExecuteResult> ExecuteNonQuery(CommandType commandType, string cmdText, List <SqlParameter> spr)
        {
            List <OrganizationExecuteResult> result = new List <OrganizationExecuteResult>();
            var organizationEntitys = new ConnectionHelper().GetOrganizationEntitys();

            foreach (var organizationEntity in organizationEntitys)
            {
                OrganizationExecuteResult organizationExecuteResult = new OrganizationExecuteResult();
                organizationExecuteResult.Code = organizationEntity.Code;
                organizationExecuteResult.Name = organizationEntity.Name;

                ISqlHelper sqlHelper = SqlConvertHelper.GetInstallSqlHelper(organizationEntity.Connectionstring);
                organizationExecuteResult.Data = sqlHelper.ExecuteNonQuery(commandType, cmdText, spr);

                result.Add(organizationExecuteResult);
            }
            return(result);
        }
        public void ExecuteNonQueryTest()
        {
            string sqlQuery = @"INSERT INTO Sample(Name, WorkProfile, Salary, Incentive, Guid, LastUpdatedDate) VALUES (@Name, @WorkProfile, @Salary, @Incentive, @Guid, @LastUpdatedDate);";

            for (int i = 0; i < 10000; i++)
            {
                var parameters = new SqlParameter[]
                {
                    new SqlParameter("@Name", $"Name - {i}"),
                    new SqlParameter("@WorkProfile", $"Work - {i}"),
                    new SqlParameter("@Salary", i * 1000),
                    new SqlParameter("@Incentive", i / (double)1000.00),
                    new SqlParameter("@Guid", Guid.NewGuid()),
                    new SqlParameter("@LastUpdatedDate", DateTime.Now),
                };
                _sqlHelper.ExecuteNonQuery(sqlQuery, CommandType.Text, parameters);
            }
            Assert.IsTrue(true);
        }
        public void DeleteOrganizationHierarchyFleetVehicles(int organizationId)
        {
            string sql = "DELETE FROM vlfFleetVehicles WHERE FleetId IN ( SELECT FleetId FROM vlfFleet WHERE OrganizationId=" + organizationId.ToString() + " AND FleetType='oh') AND IsAuto = 1";

            Int32 rows = _sqlHelper.ExecuteNonQuery(_connectionStrings.Value.SentinelFmMain, sql, CommandType.Text);
        }
        public void ClearSettings(int dataTypeNodeID)
        {
            string sql = "delete from cmsDataTypePreValues where datatypenodeid = @datatypenodeid";

            sqlHelper.ExecuteNonQuery(sql, sqlHelper.CreateParameter("@datatypenodeid", dataTypeNodeID));
        }
Exemple #25
0
 public int ExecuteNonQuery(string commandText, params IParameter[] parameters)
 {
     return(SqlHelper.ExecuteNonQuery(commandText, parameters));
 }
Exemple #26
0
 private void DeletePrevalue(int id)
 {
     SqlHelper.ExecuteNonQuery("delete from cmsDataTypePreValues where id = " + id);
 }
Exemple #27
0
        public async Task UpdateCustomerAsync(Customer customer)
        {
            try
            {
                var sql = string.Format("UPDATE customershippinginfo SET IsOld = 1  WHERE customerid = '{0}'", customer.Id);

                _sqlHelper.ExecuteNonQuery(ConnectionSettings.ConnectionString, sql, CommandType.Text);

                //sql = "UPDATE [dbo].[Customer] SET [CompanyId] = '{0}',[Name]= '{1}',[ContactPersonName]= '{2}',[PhoneNo]= '{3}',[EmailID]= '{4}',[Address]= '{5}',[City]= '{6}',[State]= '{7}',[Country]= '{8}',[ZIPCode]= '{9}',[FAXNo]= '{10}',[DateFormat]= '{11}',[noofstages]= '{12}',[CompanyProfileID] = '{13}'  WHERE id = '{14}'";

                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;
                }

                sql = string.Format($"UPDATE [dbo].[customer]SET[CompanyId] = '{customer.CompanyId}' ,[Name] = '{customer.Name.Replace("'", "''")}',[AddressLine1] = '{customer.AddressLine1.Replace("'", "''")}'" +
                                    $",[City] = '{customer.City.Replace("'", "''")}',[State] = '{customer.State.Replace("'", "''")}',[ZIPCode] = '{customer.ZIPCode.Replace("'", "''")}' ,[ContactPersonName] = '{customer.ContactPersonName.Replace("'", "''")}'" +
                                    $"      ,[TelephoneNumber] = '{customer.TelephoneNumber}' ,[FaxNumber] = '{customer.FaxNumber}',[EmailAddress] = '{customer.EmailAddress}' ,[TruckType] = '{customer.TruckType}'" +
                                    $"  ,[CollectFreight] = '{customer.CollectFreight}',[Comments] = '{customer.Comments.Replace("'", "''")}' ,[Surcharge] = '{customer.Surcharge}' ,[FOB] = '{customer.FOB}'" +
                                    $" ,[Terms] = '{customer.Terms}',[RePackingCharge] = '{customer.RePackingCharge}',[ShipVia] = '{customer.ShipVia.Replace("'", "''")}' ,[invoicingtypeid] = '{customer.Invoicingtypeid}'" +
                                    $"   ,[endcustomername] = '{customer.EndCustomerName.Replace("'", "''")}' ,[DisplayLineNo] = '{customer.DisplayLineNo}',[Billing] = '{customer.Billing.Replace("'","''")}' ,[RePackingPoNo] = '{string.Empty}' WHERE[Id] = '{customer.Id}' ");
                await _sqlHelper.ExecuteNonQueryAsync(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 ( " +
                                        $"'{customer.Id}' , '{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);
                }
            }
            catch (Exception ex)
            {
                var error = ex.Message;
            }
        }