Пример #1
0
        public int SaveState(BO.TheGridState rec, int j03id)
        {
            rec.pid = rec.j75ID;
            if (rec.j75PageSize < 0)
            {
                rec.j75PageSize = 100;
            }

            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.j75ID);
            p.AddInt("j72ID", rec.j72ID, true);
            p.AddInt("j03ID", j03id, true);
            p.AddInt("j75PageSize", rec.j75PageSize);
            p.AddInt("j75CurrentPagerIndex", rec.j75CurrentPagerIndex);
            p.AddInt("j75CurrentRecordPid", rec.j75CurrentRecordPid);
            p.AddString("j75SortDataField", rec.j75SortDataField);
            p.AddString("j75SortOrder", rec.j75SortOrder);
            p.AddString("j75Filter", rec.j75Filter);
            p.AddInt("j75HeightPanel1", rec.j75HeightPanel1);

            int intJ75ID = _db.SaveRecord("j75TheGridState", p.getDynamicDapperPars(), rec, false, true);

            return(intJ75ID);
        }
Пример #2
0
        public int Save(BO.j02Person rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

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

            p.AddInt("p28ID", rec.p28ID, true);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);

            p.AddString("j02FirstName", rec.j02FirstName);
            p.AddString("j02LastName", rec.j02LastName);
            p.AddString("j02TitleBeforeName", rec.j02TitleBeforeName);
            p.AddString("j02TitleAfterName", rec.j02TitleAfterName);
            p.AddString("j02Email", rec.j02Email);

            p.AddString("j02Tel1", rec.j02Tel1);
            p.AddString("j02Tel2", rec.j02Tel2);
            p.AddString("j02JobTitle", rec.j02JobTitle);

            return(_db.SaveRecord("j02Person", p.getDynamicDapperPars(), rec));
        }
Пример #3
0
        public int Save(BO.p13MasterTpv rec, int intP13ID_CloneP14Recs)
        {
            if (rec.p25ID == 0 || string.IsNullOrEmpty(rec.p13Code) || string.IsNullOrEmpty(rec.p13Name))
            {
                _mother.CurrentUser.AddMessage("Chybí vyplnit typ zařízení, kód nebo název receptury.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p13ID);
            p.AddInt("p25ID", rec.p25ID);
            p.AddString("p13Name", rec.p13Name);
            p.AddString("p13Code", rec.p13Code);
            p.AddString("p13Memo", rec.p13Memo);

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

            if (intP13ID_CloneP14Recs > 0 && rec.pid == 0)
            {
                var mq = new BO.myQuery("p14MasterOper");
                mq.p13id = intP13ID_CloneP14Recs;
                var lis = _mother.p14MasterOperBL.GetList(mq);
                foreach (var c in lis)
                {
                    c.pid   = 0;
                    c.p13ID = intPID;
                    _mother.p14MasterOperBL.Save(c);
                }
            }


            return(intPID);
        }
Пример #4
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);
        }
Пример #5
0
        public int SaveJ40(BO.j40MailAccount rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.j40ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("j40UsageFlag", (int)rec.j40UsageFlag);
            p.AddString("j40SmtpHost", rec.j40SmtpHost);
            p.AddInt("j40SmtpPort", rec.j40SmtpPort);
            p.AddString("j40SmtpName", rec.j40SmtpName);
            p.AddString("j40SmtpEmail", rec.j40SmtpEmail);
            p.AddString("j40SmtpLogin", rec.j40SmtpLogin);
            p.AddString("j40SmtpPassword", rec.j40SmtpPassword);
            p.AddBool("j40SmtpUseDefaultCredentials", rec.j40SmtpUseDefaultCredentials);
            p.AddBool("j40SmtpEnableSsl", rec.j40SmtpEnableSsl);
            p.AddBool("j40SmtpUsePersonalReply", rec.j40SmtpUsePersonalReply);
            p.AddString("j40ImapHost", rec.j40ImapHost);
            p.AddString("j40ImapLogin", rec.j40ImapLogin);
            p.AddString("j40ImapPassword", rec.j40ImapPassword);
            p.AddInt("j40ImapPort", rec.j40ImapPort);

            return(_db.SaveRecord("j40MailAccount", p.getDynamicDapperPars(), rec));
        }
Пример #6
0
        public int Save(BO.j04UserRole rec)
        {
            if (!_mother.CurrentUser.IsGURU())
            {
                if (rec.j04IsClientRole && (TestOnePerm(BO.UserPermFlag.MasterAdmin, rec) || TestOnePerm(BO.UserPermFlag.MasterReader, rec)))
                {
                    _db.CurrentUser.AddMessage("U [CLIENT] role musíte lze zaškrtnout pouze client oprávnění.");
                    return(0);
                }
                if (rec.j04IsClientRole == false && (TestOnePerm(BO.UserPermFlag.ClientAdmin, rec) || TestOnePerm(BO.UserPermFlag.ClientReader, rec)))
                {
                    _db.CurrentUser.AddMessage("U [MASTER] role musíte lze zaškrtnout pouze master oprávnění.");
                    return(0);
                }
            }

            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.j04ID);
            p.AddString("j04Name", rec.j04Name);
            p.AddInt("j04PermissionValue", rec.j04PermissionValue);
            p.AddBool("j04IsClientRole", rec.j04IsClientRole);

            return(_db.SaveRecord("j04UserRole", p.getDynamicDapperPars(), rec));
        }
Пример #7
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));
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
0
        public int Save(BO.p25MszType rec)
        {
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p25ID);
            p.AddString("p25Name", rec.p25Name);
            p.AddString("p25Code", rec.p25Code);
            p.AddString("p25Memo", rec.p25Memo);


            return(_db.SaveRecord("p25MszType", p.getDynamicDapperPars(), rec));
        }
Пример #11
0
        public int Save(BO.o51Tag rec)
        {
            if (rec.o51Name.Contains(","))
            {
                _mother.CurrentUser.AddMessage("Název položky kategorie nesmí obsahovat čárku.");
                return(0);
            }
            if (rec.o51Name.Length > 30)
            {
                _mother.CurrentUser.AddMessage("V názvu položky kategorie může být maximálně 30 znaků.");
                return(0);
            }

            if (GetList(new BO.myQuery("o51Tag")).Where(p => p.pid != rec.pid && p.o51Name.ToLower() == rec.o51Name.Trim().ToLower()).Count() > 0)
            {
                _mother.CurrentUser.AddMessage("Položka kategorie s tímto názvem již existuje.");
                return(0);
            }

            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.o51ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddInt("o53ID", rec.o53ID, true);
            p.AddString("o51Name", rec.o51Name);
            p.AddString("o51Code", rec.o51Code);
            p.AddInt("o51Ordinary", rec.o51Ordinary);

            p.AddBool("o51IsColor", rec.o51IsColor);
            if (rec.o51IsColor == false)
            {
                rec.o51ForeColor = "";
                rec.o51BackColor = "";
            }
            p.AddString("o51ForeColor", rec.o51ForeColor);
            p.AddString("o51BackColor", rec.o51BackColor);

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

            var pars = new Dapper.DynamicParameters();

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

            return(intPID);
        }
Пример #12
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);
        }
Пример #13
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));
        }
Пример #14
0
        public int Save(BO.p28Company rec, BO.j02Person recFirstPerson)
        {
            if (recFirstPerson != null)
            {
                if (String.IsNullOrEmpty(recFirstPerson.j02FirstName) || String.IsNullOrEmpty(recFirstPerson.j02LastName))
                {
                    _mother.CurrentUser.AddMessage("U kontaktní osoby musíte vyplnit [Jméno] a [Příjmení] nebo odškrtněte, že se má založit první kontaktní osoba klienta.");
                    return(0);
                }
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p28ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddString("p28Name", rec.p28Name);
            p.AddString("p28ShortName", rec.p28ShortName);
            p.AddString("p28Code", rec.p28Code);
            p.AddString("p28CloudID", rec.p28CloudID);
            p.AddString("p28RegID", rec.p28RegID);
            p.AddString("p28VatID", rec.p28VatID);
            p.AddString("p28Street1", rec.p28Street1);
            p.AddString("p28City1", rec.p28City1);
            p.AddString("p28PostCode1", rec.p28PostCode1);
            p.AddString("p28Country1", rec.p28Country1);
            p.AddString("p28Street2", rec.p28Street2);
            p.AddString("p28City2", rec.p28City2);
            p.AddString("p28PostCode2", rec.p28PostCode2);
            p.AddString("p28Country2", rec.p28Country2);

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

            if (intPID > 0 && recFirstPerson != null)
            {
                recFirstPerson.p28ID = intPID;
                _mother.j02PersonBL.Save(recFirstPerson);
            }

            return(intPID);
        }
Пример #15
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);
        }
Пример #16
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));
        }
Пример #17
0
        public int Save(BO.p12ClientTpv rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p12ID);
            p.AddInt("p21ID", rec.p21ID, true);
            p.AddInt("p25ID", rec.p25ID, true);
            p.AddString("p12Name", rec.p12Name);
            p.AddString("p12Code", rec.p12Code);
            p.AddString("p12Memo", rec.p12Memo);

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


            return(intPID);
        }
Пример #18
0
        public int Save(BO.p27MszUnit rec)
        {
            if (rec.p25ID_HW == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vyplnit Kmenový typ zařízení.");
                return(0);
            }
            var p = new DL.Params4Dapper();

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

            p.AddInt("p31ID", rec.p31ID, true);
            p.AddInt("p25ID_HW", rec.p25ID_HW, true);
            p.AddString("p27Name", rec.p27Name);
            p.AddString("p27Code", rec.p27Code);
            p.AddDouble("p27Capacity", rec.p27Capacity);


            return(_db.SaveRecord("p27MszUnit", p.getDynamicDapperPars(), rec));
        }
Пример #19
0
        public int Save(BO.p31CapacityFond rec)
        {
            if (rec.p31DayHour1 >= rec.p31DayHour2)
            {
                _mother.CurrentUser.AddMessage("Poslední hodina musí být větší než první hodina.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p31ID);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddString("p31Name", rec.p31Name);
            p.AddInt("p31DayHour1", rec.p31DayHour1);
            p.AddInt("p31DayHour2", rec.p31DayHour2);

            return(_db.SaveRecord("p31CapacityFond", p.getDynamicDapperPars(), rec));
        }
Пример #20
0
        public int Save(BO.p14MasterOper rec)
        {
            if (rec.p18ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vazba na číselník [Kód operace].");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p14ID);
            p.AddInt("p13ID", rec.p13ID, true);
            p.AddInt("p19ID", rec.p19ID, true);
            p.AddInt("p18ID", rec.p18ID, true);

            p.AddInt("p14RowNum", -1 + rec.p14RowNum * 100);
            p.AddInt("p14OperNum", rec.p14OperNum);
            p.AddDouble("p14OperParam", rec.p14OperParam);
            p.AddDouble("p14UnitsCount", rec.p14UnitsCount);
            p.AddDouble("p14DurationPreOper", rec.p14DurationPreOper);
            p.AddDouble("p14DurationPostOper", rec.p14DurationPostOper);
            p.AddDouble("p14DurOperUnits", rec.p14DurOperUnits);
            p.AddDouble("p14DurOperMinutes", rec.p14DurOperMinutes);
            if (rec.p14DurOperMinutes > 0 && rec.p14DurOperUnits > 0)
            {
                p.AddDouble("p14DurationOper", rec.p14DurOperMinutes / rec.p14DurOperUnits);
            }
            else
            {
                p.AddDouble("p14DurationOper", rec.p14DurationOper);
            }

            var intPID = _db.SaveRecord("p14MasterOper", p.getDynamicDapperPars(), rec);

            _db.RunSql("UPDATE p14MasterOper SET p14RowNum=p14RowNum*100 WHERE p13ID=@p13id AND p14ID<>@pid", new { p13id = rec.p13ID, pid = intPID });
            _db.RunSql("update a set p14RowNum=RowID from (SELECT ROW_NUMBER() OVER(ORDER BY p14RowNum ASC) AS RowID,* FROM p14MasterOper WHERE p13ID=@p13id) a", new { p13id = rec.p13ID });

            _db.RunSql("UPDATE p13MasterTpv SET p13TotalDuration=(SELECT sum(isnull(p14DurationPreOper,0)+isnull(p14DurationOper,0)+isnull(p14DurationPostOper,0)) FROM p14MasterOper WHERE p13ID=@pid) WHERE p13ID=@pid", new { pid = rec.p13ID });

            return(intPID);
        }
Пример #21
0
        public int Save(BO.p18OperCode rec)
        {
            if (LoadByCode(rec.p18Code, rec.p25ID, rec.p18ID) != null)
            {
                _mother.CurrentUser.AddMessage("Kód operace nesmí být duplicitní v rámci jednoho typu zařízení.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p18ID);
            p.AddInt("p25ID", rec.p25ID, true);
            p.AddInt("p19ID", rec.p19ID, true);
            p.AddInt("p18Flag", rec.p18Flag);
            p.AddString("p18Name", rec.p18Name);
            p.AddString("p18Code", rec.p18Code);
            p.AddString("p18Memo", rec.p18Memo);
            p.AddDouble("p18UnitsCount", rec.p18UnitsCount);
            p.AddDouble("p18DurationPreOper", rec.p18DurationPreOper);
            p.AddDouble("p18DurOperUnits", rec.p18DurOperUnits);
            p.AddDouble("p18DurOperMinutes", rec.p18DurOperMinutes);
            if (rec.p18DurOperMinutes > 0 && rec.p18DurOperUnits > 0)
            {
                p.AddDouble("p18DurationOper", rec.p18DurOperMinutes / rec.p18DurOperUnits);
            }
            else
            {
                p.AddDouble("p18DurationOper", rec.p18DurationOper);
            }

            p.AddDouble("p18DurationPostOper", rec.p18DurationPostOper);
            p.AddDouble("p18OperParam", rec.p18OperParam);
            p.AddString("p18Lang1", rec.p18Lang1);
            p.AddString("p18Lang2", rec.p18Lang2);
            p.AddString("p18Lang3", rec.p18Lang3);
            p.AddString("p18Lang4", rec.p18Lang4);
            p.AddBool("p18IsRepeatable", rec.p18IsRepeatable);
            p.AddBool("p18IsManualAmount", rec.p18IsManualAmount);

            return(_db.SaveRecord("p18OperCode", p.getDynamicDapperPars(), rec));
        }
Пример #22
0
        public int Save(BO.b03StatusGroup rec, List <int> b02ids)
        {
            var p = new DL.Params4Dapper();

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

            p.AddString("b03Name", rec.b03Name);

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

            if (b02ids != null)
            {
                if (rec.pid > 0)
                {
                    _db.RunSql("DELETE FROM b04StatusGroupBinding WHERE b03ID=@pid", new { pid = intPID });
                }
                if (b02ids.Count > 0)
                {
                    _db.RunSql("INSERT INTO b04StatusGroupBinding(b03ID,b02ID) SELECT @pid,b02ID FROM b02Status WHERE b02ID IN (" + string.Join(",", b02ids) + ")", new { pid = intPID });
                }
            }
            return(intPID);
        }
Пример #23
0
        public int Save(BO.p20Unit rec)
        {
            var p = new DL.Params4Dapper();

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

            p.AddString("p20Name", rec.p20Name);
            p.AddString("p20Code", rec.p20Code);
            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 se musí položka měrné jednotky povinně svázat s klientem z vašeho profilu.");
                return(0);
            }


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

            p.AddInt("pid", rec.b02ID);
            p.AddString("b02Name", rec.b02Name);
            p.AddString("b02Code", rec.b02Code);
            p.AddString("b02Entity", rec.b02Entity);
            p.AddInt("b02Ordinary", rec.b02Ordinary);
            p.AddString("b02Memo", rec.b02Memo);
            p.AddEnumInt("b02StartFlag", rec.b02StartFlag);
            p.AddEnumInt("b02MoveFlag", rec.b02MoveFlag);
            p.AddString("b02MoveBySql", rec.b02MoveBySql);
            p.AddString("b02Color", rec.b02Color);

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

            if (rec.b02StartFlag == BO.b02StartFlagENUM.DefaultStatus)
            {
                _db.RunSql("UPDATE b02Status SET b02StartFlag=0 WHERE b02Entity LIKE @entity AND b02ID<>@pid", new { entity = rec.b02Entity, pid = intPID });
            }
            return(intPID);
        }
Пример #25
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);
        }
Пример #26
0
        public int Save(BO.p26Msz rec, List <int> p27IDs)
        {
            if (rec.p25ID == 0)
            {
                _mother.CurrentUser.AddMessage("Chybí vyplnit typ zařízení.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.p26ID);
            if (rec.pid == 0)
            {
                rec.b02ID = _mother.b02StatusBL.LoadStartStatusPID("p26", rec.b02ID);  //startovací workflow stav
            }
            p.AddInt("p25ID", rec.p25ID, true);
            p.AddInt("b02ID", rec.b02ID, true);
            p.AddInt("p28ID", rec.p28ID, true);
            p.AddString("p26Name", rec.p26Name);
            p.AddString("p26Code", rec.p26Code);
            p.AddString("p26Memo", rec.p26Memo);


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

            if (p27IDs != null)
            {
                _db.RunSql("DELETE FROM p29MszUnitBinding WHERE p26ID=@pid", new { pid = intPID });
                if (p27IDs.Count > 0)
                {
                    _db.RunSql("INSERT INTO p29MszUnitBinding(p26ID,p27ID) SELECT @pid,p27ID FROM p27MszUnit WHERE p27ID IN (" + string.Join(",", p27IDs) + ")", new { pid = intPID });
                }
            }



            return(intPID);
        }
Пример #27
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));
        }
Пример #28
0
        public int Save(BO.x31Report rec)
        {
            if (ValidateBeforeSave(rec) == false)
            {
                return(0);
            }
            var p = new DL.Params4Dapper();

            p.AddInt("pid", rec.x31ID);
            p.AddString("x31Entity", rec.x31Entity);
            p.AddString("x31FileName", rec.x31FileName);
            p.AddString("x31Name", rec.x31Name);
            p.AddString("x31Code", rec.x31Code);

            p.AddEnumInt("x31ReportFormat", rec.x31ReportFormat);
            p.AddString("x31Description", rec.x31Description);
            p.AddBool("x31Is4SingleRecord", rec.x31Is4SingleRecord);

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



            return(intPID);
        }
Пример #29
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);
        }
Пример #30
0
        public int Save(BO.o53TagGroup rec)
        {
            if (String.IsNullOrEmpty(rec.o53Entities) == true)
            {
                _mother.CurrentUser.AddMessage("Chybí vazba na entity.");
                return(0);
            }
            var p = new DL.Params4Dapper();

            if (rec.o53Field == null)//najít volné pole pro grid
            {
                var lis           = GetList(new BO.myQuery("o53TagGroup")).Where(p => p.o53Field != null).OrderByDescending(p => p.o53Field);
                int intFieldIndex = 1;
                if (lis.Count() > 0)
                {
                    intFieldIndex = 1 + Convert.ToInt32(BO.BAS.RightString(lis.First().o53Field, 2));
                }
                rec.o53Field = "o54Group" + BO.BAS.RightString("0" + intFieldIndex.ToString(), 2);
            }

            p.AddInt("pid", rec.o53ID);
            p.AddString("o53Name", rec.o53Name);
            if (rec.j02ID_Owner == 0)
            {
                rec.j02ID_Owner = _db.CurrentUser.j02ID;
            }
            p.AddInt("j02ID_Owner", rec.j02ID_Owner, true);
            p.AddString("o53Entities", rec.o53Entities);
            p.AddInt("o53Ordinary", rec.o53Ordinary);
            p.AddBool("o53IsMultiSelect", rec.o53IsMultiSelect);
            p.AddString("o53Field", rec.o53Field);



            return(_db.SaveRecord("o53TagGroup", p.getDynamicDapperPars(), rec));
        }