Beispiel #1
0
        internal bool CreateClient(ClientInfo clInfo)
        {
            if (string.IsNullOrWhiteSpace(clInfo.ClientName) /*|| string.IsNullOrWhiteSpace(clInfo.ServerScanLink)*/ || string.IsNullOrWhiteSpace(clInfo.Requisites))
            {
                return(false);
            }

            if (clInfo.LocalScanLink != null)
            {
                if (!Directory.Exists(GlobalSettings.ScanDirectory))
                {
                    Directory.CreateDirectory(GlobalSettings.ScanDirectory);
                }
                try
                {
                    File.Copy(clInfo.LocalScanLink, clInfo.ServerScanLink, false);
                }
                catch { return(false); }
            }

            var createClient = SqlQueryBuilder.InsertClient(clInfo.Org_Id, clInfo.ClientName, (int)clInfo.FidDocType, clInfo.Requisites, clInfo.ServerScanLink, DBConnection);

            if (CommitDML(createClient))
            {
                return(true);
            }
            else
            {
                File.Delete(clInfo.ServerScanLink);
                return(false);
            }
        }