Пример #1
0
        public int SaveCells(List <BO.p33CapacityTimeline> cells)
        {
            int sucs = 0;

            foreach (var rec in cells)
            {
                var p = new DL.Params4Dapper();
                p.AddInt("pid", rec.p33ID);
                p.AddInt("p31ID", rec.p31ID, true);
                p.AddDateTime("p33Date", rec.p33Date);
                p.AddDateTime("p33DateTime", rec.p33DateTime);

                p.AddInt("p33Day", rec.p33Day);
                p.AddInt("p33Hour", rec.p33Hour);
                p.AddInt("p33Minute", rec.p33Minute);



                if (_db.SaveRecord("p33CapacityTimeline", p.getDynamicDapperPars(), rec) > 0)
                {
                    sucs += 1;
                }
            }

            return(sucs);
        }
Пример #2
0
        public int Save(BO.p51Order rec, List <BO.p52OrderItem> newitems)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            if (newitems != null)
            {
                if (newitems.Where(p => p.p11ID == 0).Count() > 0)
                {
                    _mother.CurrentUser.AddMessage("V položkách je nevyplněný produkt."); return(0);
                }
                if (newitems.Where(p => p.p52UnitsCount <= 0).Count() > 0)
                {
                    _mother.CurrentUser.AddMessage("V položkách je nekorektně zadané množství produktu."); return(0);
                }
            }

            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p51ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p28ID", rec.p28ID, true);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p51", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddBool("p51IsDraft", rec.p51IsDraft);
            p.AddString("p51Name", rec.p51Name);
            p.AddString("p51Code", rec.p51Code);
            p.AddString("p51Memo", rec.p51Memo);
            p.AddString("p51CodeByClient", rec.p51CodeByClient);

            p.AddDateTime("p51Date", rec.p51Date);
            p.AddDateTime("p51DateDelivery", rec.p51DateDelivery);
            p.AddDateTime("p51DateDeliveryConfirmed", rec.p51DateDeliveryConfirmed);

            int intP51ID = _db.SaveRecord("p51Order", p.getDynamicDapperPars(), rec);

            if (newitems != null)
            {
                foreach (var c in newitems)
                {
                    c.p51ID = intP51ID;
                    _mother.p52OrderItemBL.Save(c);

                    //_db.RunSql("INSERT INTO p52OrderItem(p51ID,p11ID,p52UnitsCount) VALUES(@p51id,@p11id,@unitscount)", new { p51id = intP51ID, p11id = c.p11ID, unitscount = c.p52UnitsCount });
                }
            }



            return(intP51ID);
        }
Пример #3
0
        private int SaveX40(MailMessage m, BO.x40MailQueue rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.x40ID);
            p.AddString("x40MessageGuid", rec.x40MessageGuid);
            p.AddInt("j40ID", rec.j40ID, true);
            if (rec.j03ID == 0)
            {
                rec.j03ID = _mother.CurrentUser.pid;
            }
            p.AddInt("j03ID", rec.j03ID, true);
            p.AddInt("x40RecordPid", rec.x40RecordPid, true);
            p.AddString("x40Entity", rec.x40Entity);

            p.AddString("x40SenderAddress", m.From.Address);
            p.AddString("x40SenderName", m.From.DisplayName);
            p.AddString("x40To", String.Join(",", m.To.Select(p => p.Address)));
            p.AddString("x40Bcc", String.Join(",", m.Bcc.Select(p => p.Address)));
            p.AddString("x40Cc", String.Join(",", m.CC.Select(p => p.Address)));
            p.AddString("x40Subject", m.Subject);
            p.AddString("x40Body", m.Body);
            p.AddBool("x40IsHtmlBody", m.IsBodyHtml);
            p.AddDateTime("x40WhenProceeded", DateTime.Now);
            p.AddString("x40ErrorMessage", rec.x40ErrorMessage);
            p.AddInt("x40State", (int)rec.x40State);
            p.AddString("x40Attachments", String.Join(",", m.Attachments.Select(p => p.Name)));
            p.AddString("x40EmlFolder", rec.x40EmlFolder);
            p.AddInt("x40EmlFileSize", rec.x40EmlFileSize);
            return(_db.SaveRecord("x40MailQueue", p.getDynamicDapperPars(), rec));
        }
Пример #4
0
        public int Save(BO.p45TaskOperReal rec)
        {
            if (rec.p41ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí p41ID.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p45ID);

            p.AddInt("p41ID", rec.p41ID, true);
            p.AddInt("p18ID", rec.p18ID, true);
            p.AddInt("p19ID", rec.p19ID, true);

            p.AddString("p45Name", rec.p45Name);
            p.AddString("p45MaterialCode", rec.p45MaterialCode);
            p.AddString("p45MaterialBatch", rec.p45MaterialBatch);
            p.AddString("p45MaterialName", rec.p45MaterialName);


            p.AddInt("p45RowNum", rec.p45RowNum);
            p.AddString("p45OperCode", rec.p45OperCode);
            p.AddInt("p45OperNum", rec.p45OperNum);
            p.AddDouble("p45OperParam", rec.p45OperParam);
            p.AddString("p45OperStatus", rec.p45OperStatus);
            p.AddDateTime("p45Start", rec.p45Start);
            p.AddDateTime("p45End", rec.p45End);
            p.AddInt("p45EndFlag", rec.p45EndFlag);
            p.AddDouble("p45MaterialUnitsCount", rec.p45MaterialUnitsCount);
            p.AddDouble("p45TotalDurationOperMin", rec.p45TotalDurationOperMin);
            p.AddString("p45Operator", rec.p45Operator);

            int intP45ID = _db.SaveRecord("p45TaskOperReal", p.getDynamicDapperPars(), rec);

            var pars = new Dapper.DynamicParameters();

            pars.Add("userid", _db.CurrentUser.pid);
            pars.Add("pid", rec.p41ID, System.Data.DbType.Int32);
            pars.Add("err_ret", "", System.Data.DbType.String, System.Data.ParameterDirection.Output);
            _db.RunSp("p41_after_p45save", ref pars);


            return(intP45ID);
        }
Пример #5
0
        public int Save(BO.o23Doc rec, List <BO.o27Attachment> lisO27_Append, List <int> o27IDs_Remove = null)
        {
            if (rec.o23RecordPid == 0)
            {
                _db.CurrentUser.AddMessage("Chybí vyplnit svázaný záznam k dokumentu!");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.o23ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("o23RecordPid", rec.o23RecordPid, true);
            p.AddString("o23Entity", rec.o23Entity);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("o23", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddDateTime("o23Date", rec.o23Date);
            p.AddString("o23Name", rec.o23Name);
            p.AddString("o23Code", rec.o23Code);
            p.AddString("o23Entity", rec.o23Entity);
            p.AddString("o23Memo", rec.o23Memo);


            int intO23ID = _db.SaveRecord("o23Doc", p.getDynamicDapperPars(), rec);

            if (intO23ID > 0 && lisO27_Append != null && lisO27_Append.Count > 0)
            {
                foreach (var c in lisO27_Append)
                {
                    p = new DL.Params4Dapper();
                    p.AddInt("pid", 0);
                    p.AddInt("o23ID", intO23ID, true);
                    p.AddString("o27Name", c.o27Name);
                    p.AddString("o27ArchiveFileName", c.o27ArchiveFileName);
                    p.AddString("o27ArchiveFolder", c.o27ArchiveFolder);
                    p.AddInt("o27FileSize", c.o27FileSize);
                    p.AddString("o27ContentType", c.o27ContentType);
                    p.AddString("o27GUID", c.o27GUID);
                    _db.SaveRecord("o27Attachment", p.getDynamicDapperPars(), c);
                }
            }
            if (intO23ID > 0 && o27IDs_Remove != null && o27IDs_Remove.Count > 0)
            {
                foreach (var intO27ID in o27IDs_Remove)
                {
                    _db.RunSql("DELETE FROM o27Attachment WHERE o27ID=@o27id", new { o27id = intO27ID });
                }
            }

            return(intO23ID);
        }
Пример #6
0
        public int Save(BO.p85Tempbox rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p85ID);
            p.AddString("p85GUID", rec.p85GUID);
            p.AddString("p85Prefix", rec.p85Prefix);
            p.AddInt("p85RecordPid", rec.p85RecordPid, true);
            p.AddInt("p85ClonePid", rec.p85ClonePid);
            p.AddBool("p85IsDeleted", rec.p85IsDeleted);

            p.AddInt("p85OtherKey1", rec.p85OtherKey1, true);
            p.AddInt("p85OtherKey2", rec.p85OtherKey2, true);
            p.AddInt("p85OtherKey3", rec.p85OtherKey3, true);
            p.AddInt("p85OtherKey4", rec.p85OtherKey4, true);
            p.AddInt("p85OtherKey5", rec.p85OtherKey5, true);

            p.AddString("p85FreeText01", rec.p85FreeText01);
            p.AddString("p85FreeText02", rec.p85FreeText02);
            p.AddString("p85FreeText03", rec.p85FreeText03);
            p.AddString("p85FreeText04", rec.p85FreeText04);
            p.AddString("p85FreeText05", rec.p85FreeText05);
            p.AddString("p85FreeText06", rec.p85FreeText06);

            p.AddBool("p85FreeBoolean01", rec.p85FreeBoolean01);
            p.AddBool("p85FreeBoolean02", rec.p85FreeBoolean02);
            p.AddBool("p85FreeBoolean03", rec.p85FreeBoolean03);
            p.AddBool("p85FreeBoolean04", rec.p85FreeBoolean04);

            p.AddDouble("p85FreeNumber01", rec.p85FreeNumber01);
            p.AddDouble("p85FreeNumber02", rec.p85FreeNumber02);
            p.AddDouble("p85FreeNumber03", rec.p85FreeNumber03);
            p.AddDouble("p85FreeNumber04", rec.p85FreeNumber04);
            p.AddDouble("p85FreeNumber05", rec.p85FreeNumber05);
            p.AddDouble("p85FreeNumber06", rec.p85FreeNumber06);

            p.AddDateTime("p85FreeDate01", rec.p85FreeDate01);
            p.AddDateTime("p85FreeDate02", rec.p85FreeDate02);
            p.AddDateTime("p85FreeDate03", rec.p85FreeDate03);
            p.AddDateTime("p85FreeDate04", rec.p85FreeDate04);

            return(_db.SaveRecord("p85Tempbox", p.getDynamicDapperPars(), rec));
        }
Пример #7
0
        public int Save(BO.p21License rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p21ID);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p21", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddInt("p28ID", rec.p28ID, true);

            p.AddEnumInt("p21PermissionFlag", rec.p21PermissionFlag);
            p.AddString("p21Name", rec.p21Name);
            p.AddString("p21Code", rec.p21Code);
            p.AddString("p21Memo", rec.p21Memo);
            p.AddDouble("p21Price", rec.p21Price);
            p.AddDateTime("ValidFrom", rec.ValidFrom);
            p.AddDateTime("ValidUntil", rec.ValidUntil);

            int intPID = _db.SaveRecord("p21License", p.getDynamicDapperPars(), rec);

            return(intPID);
        }
Пример #8
0
        public int Save(BO.p19Material rec)
        {
            if (rec.p20ID == 0)
            {
                _db.CurrentUser.AddMessage("Chybí vyplnit měrná jednotka."); return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p19ID);
            p.AddInt("p20ID", rec.p20ID, true);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p28ID", rec.p28ID, true);
            if (_db.CurrentUser.j03EnvironmentFlag == 2 && rec.p28ID != _db.CurrentUser.p28ID)
            {
                _db.CurrentUser.AddMessage("V klientském režimu se pořizuje materiál na míru klienta. Musíte záznam svázat s klientem s vazbou na váš profil.");
                return(0);
            }
            p.AddEnumInt("p19TypeFlag", rec.p19TypeFlag);
            p.AddInt("p10ID_Master", rec.p10ID_Master, true);
            p.AddString("p19Name", rec.p19Name);
            p.AddString("p19Code", rec.p19Code);
            p.AddString("p19Memo", rec.p19Memo);

            p.AddString("p19Supplier", rec.p19Supplier);
            p.AddString("p19Intrastat", rec.p19Intrastat);
            p.AddString("p19NameAlias", rec.p19NameAlias);
            p.AddString("p19ITSINC", rec.p19ITSINC);
            p.AddString("p19ITSCAS", rec.p19ITSCAS);
            p.AddString("p19ITSEINECS", rec.p19ITSEINECS);

            p.AddString("p19Lang1", rec.p19Lang1);
            p.AddString("p19Lang2", rec.p19Lang2);
            p.AddString("p19Lang3", rec.p19Lang3);
            p.AddString("p19Lang4", rec.p19Lang4);

            p.AddDouble("p19StockActual", rec.p19StockActual);
            p.AddDouble("p19StockReserve", rec.p19StockReserve);
            p.AddDateTime("p19StockDate", rec.p19StockDate);

            return(_db.SaveRecord("p19Material", p.getDynamicDapperPars(), rec));
        }
Пример #9
0
        public int Save(BO.p41Task rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p41ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p27ID", rec.p27ID, true);
            p.AddInt("p52ID", rec.p52ID, true);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p41", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddInt("p41MasterID", rec.p41MasterID, true);         //ID master zakázky
            p.AddInt("p41SuccessorID", rec.p41SuccessorID, true);   //ID následníka
            p.AddBool("p41IsDraft", rec.p41IsDraft);
            p.AddString("p41Name", rec.p41Name);
            p.AddString("p41Code", rec.p41Code);
            p.AddString("p41Memo", rec.p41Memo);
            p.AddString("p41StockCode", rec.p41StockCode);

            if (rec.p41PlanStart.Year > 1900)
            {
                p.AddDateTime("p41PlanStart", rec.p41PlanStart);
            }


            p.AddDouble("p41PlanUnitsCount", rec.p41PlanUnitsCount);

            int intPID = _db.SaveRecord("p41Task", p.getDynamicDapperPars(), rec);

            run_p41_after_save(intPID);

            return(intPID);
        }
Пример #10
0
        public int Save(BO.p52OrderItem rec)
        {
            if (rec.p51ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí hlavička objednávky."); return(0);
            }
            if (rec.p11ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vyplnit produkt."); return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p52ID);
            p.AddInt("p51ID", rec.p51ID, true);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("p11ID", rec.p11ID, true);
            p.AddDouble("p52UnitsCount", rec.p52UnitsCount);
            p.AddDateTime("p52DateNeeded", rec.p52DateNeeded);

            int intP52ID = _db.SaveRecord("p52OrderItem", p.getDynamicDapperPars(), rec);

            var pars = new Dapper.DynamicParameters();

            pars.Add("userid", _db.CurrentUser.pid);
            pars.Add("pid", intP52ID, System.Data.DbType.Int32);
            pars.Add("err_ret", "", System.Data.DbType.String, System.Data.ParameterDirection.Output);
            _db.RunSp("p52_after_save", ref pars);

            //_mother.p51OrderBL.AdjustItemsCode(_mother.p51OrderBL.Load(rec.p51ID));


            return(intP52ID);
        }
Пример #11
0
        public int Save(BO.j03User rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.j03ID);
            p.AddInt("j02ID", rec.j02ID, true);
            p.AddInt("j04ID", rec.j04ID, true);
            p.AddBool("j03IsMustChangePassword", rec.j03IsMustChangePassword);
            p.AddString("j03Login", rec.j03Login);
            p.AddInt("j03AccessFailedCount", rec.j03AccessFailedCount);
            p.AddInt("j03ModalDialogFlag", rec.j03ModalDialogFlag);
            p.AddInt("j03FontStyleFlag", rec.j03FontStyleFlag);
            p.AddInt("j03SideBarFlag", rec.j03SideBarFlag);
            p.AddInt("j03EnvironmentFlag", rec.j03EnvironmentFlag);
            p.AddInt("j03GridSelectionModeFlag", rec.j03GridSelectionModeFlag);
            p.AddDateTime("j03LiveChatTimestamp", rec.j03LiveChatTimestamp);
            if (!String.IsNullOrEmpty(rec.j03PasswordHash))
            {
                p.Add("j03PasswordHash", rec.j03PasswordHash);
            }


            return(_db.SaveRecord("j03User", p.getDynamicDapperPars(), rec));
        }
Пример #12
0
        public int Save(BO.j72TheGridTemplate rec, List <BO.j73TheGridQuery> lisJ73, List <int> j04ids, List <int> j11ids)
        {
            if (ValidateBeforeSave(rec, lisJ73) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.j72ID);
            p.AddString("j72Name", rec.j72Name);
            p.AddBool("j72IsSystem", rec.j72IsSystem);
            p.AddInt("j03ID", rec.j03ID, true);

            p.AddString("j72Entity", rec.j72Entity);
            p.AddString("j72MasterEntity", rec.j72MasterEntity);
            p.AddString("j72Columns", rec.j72Columns);
            p.AddInt("j72SplitterFlag", rec.j72SplitterFlag);
            p.AddBool("j72IsMainMenu", rec.j72IsMainMenu);

            p.AddBool("j72IsNoWrap", rec.j72IsNoWrap);
            p.AddInt("j72SelectableFlag", rec.j72SelectableFlag);
            p.AddBool("j72IsPublic", rec.j72IsPublic);


            if (lisJ73 != null)
            {
                p.AddBool("j72HashJ73Query", false);
            }

            int intJ72ID = _db.SaveRecord("j72TheGridTemplate", p.getDynamicDapperPars(), rec);

            if (j04ids != null && j11ids != null)
            {
                if (rec.pid > 0)
                {
                    _db.RunSql("if EXISTS(select j74ID FROM j74TheGridReceiver WHERE j72ID=@pid) DELETE FROM j74TheGridReceiver WHERE j72ID=@pid", new { pid = intJ72ID });
                }
                if (j04ids.Count > 0)
                {
                    _db.RunSql("INSERT INTO j74TheGridReceiver(j72ID,j04ID) SELECT @pid,j04ID FROM j04UserRole WHERE j04ID IN (" + string.Join(",", j04ids) + ")", new { pid = intJ72ID });
                }
                if (j11ids.Count > 0)
                {
                    _db.RunSql("INSERT INTO j74TheGridReceiver(j72ID,j04ID) SELECT @pid,j11ID FROM j11Team WHERE j11ID IN (" + string.Join(",", j11ids) + ")", new { pid = intJ72ID });
                }
            }
            if (lisJ73 != null)
            {
                if (rec.pid > 0)
                {
                    _db.RunSql("if EXISTS(select j73ID FROM j73TheGridQuery WHERE j72ID=@pid) DELETE FROM j73TheGridQuery WHERE j72ID=@pid", new { pid = intJ72ID });
                }
                foreach (var c in lisJ73)
                {
                    if (c.IsTempDeleted == true && c.j73ID > 0)
                    {
                        _db.RunSql("DELETE FROM j73TheGridQuery WHERE j73ID=@pid", new { pid = c.j73ID });
                    }
                    else
                    {
                        p = new DL.Params4Dapper();
                        p.AddInt("pid", c.j73ID, true);
                        p.AddInt("j72ID", intJ72ID, true);
                        p.AddString("j73Column", c.j73Column);
                        p.AddString("j73Operator", c.j73Operator);
                        p.AddInt("j73ComboValue", c.j73ComboValue);
                        p.AddInt("j73DatePeriodFlag", c.j73DatePeriodFlag);
                        if (c.j73DatePeriodFlag > 0)
                        {
                            c.j73Date1 = null; c.j73Date2 = null;
                        }
                        p.AddDateTime("j73Date1", c.j73Date1);
                        p.AddDateTime("j73Date2", c.j73Date2);
                        p.AddDouble("j73Num1", c.j73Num1);
                        p.AddDouble("j73Num2", c.j73Num2);
                        p.AddString("j73Value", c.j73Value);
                        p.AddString("j73ValueAlias", c.j73ValueAlias);
                        p.AddInt("j73Ordinal", c.j73Ordinal);
                        p.AddString("j73Op", c.j73Op);
                        p.AddString("j73BracketLeft", c.j73BracketLeft);
                        p.AddString("j73BracketRight", c.j73BracketRight);
                        _db.SaveRecord("j73TheGridQuery", p.getDynamicDapperPars(), c, false, true);
                    }
                }
                if (GetList_j73(intJ72ID, rec.j72Entity.Substring(0, 3)).Count() > 0)
                {
                    _db.RunSql("UPDATE j72TheGridTemplate set j72HashJ73Query=1 WHERE j72ID=@pid", new { pid = intJ72ID });
                }
            }

            return(intJ72ID);
        }