Exemplo n.º 1
0
        public static MethodReturn RepairDepoRaf(SERVISDEPOLAR depo, string strRaf, decimal servisId)
        {
            MethodReturn ret = new MethodReturn();

            if (depo == null)
            {
                return(ret);
            }

            if (strRaf.isNullOrWhiteSpace())
            {
                strRaf = "1.Raf";
            }

            SERVISDEPORAFLAR foundRaf = R.Query <SERVISDEPORAFLAR>(ret).First(t => t.SERVISDEPOID == depo.ID && t.AD == strRaf).createIsNull();

            if (ret.ok() && foundRaf.IsNew())
            {
                decimal seqId = Convert.ToDecimal(SasonBase.SasonBaseApplicationPool.Get.EbaTestConnector.ExecuteScalar("select SERVISDEPORAFLAR_SEQ.NEXTVAL from dual", ret));
                if (ret.ok())
                {
                    foundRaf.ID           = seqId;
                    foundRaf.KOD          = strRaf;
                    foundRaf.AD           = strRaf;
                    foundRaf.SERVISDEPOID = depo.ID;
                    foundRaf.DURUMID      = 1;

                    ret = foundRaf.Update();
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
        public static SERVISDEPOLAR CheckAndGetDefaultDepo(MethodReturn refMr, decimal servisId, string depoAdi = "")
        {
            refMr = refMr.createIsNull();

            string writeDepoKodu = "001";
            string writeDepoAdi  = "Ana Depo";

            SERVISDEPOLAR defaultDepo = null;

            if (depoAdi.isNullOrWhiteSpace())
            {
                defaultDepo = Select.OrderBy(t => t.KOD).First(t => t.SERVISID == servisId);
            }
            else
            {
                writeDepoKodu = depoAdi;
                writeDepoAdi  = depoAdi;
                defaultDepo   = Select.First(t => t.AD == writeDepoAdi && t.SERVISID == servisId);
            }

            if (defaultDepo.isNull())
            {
                decimal seqId = Convert.ToDecimal(SasonBaseApplicationPool.Get.EbaTestConnector.ExecuteScalar("select SERVISDEPOLAR_SEQ.NEXTVAL from dual", refMr));
                if (refMr.ok())
                {
                    defaultDepo = new SERVISDEPOLAR()
                    {
                        ID  = seqId,
                        KOD = writeDepoKodu,            // "001",
                        AD  = writeDepoAdi,             // "Ana Depo",
                        SERVISDEPOGRUPID = null,
                        DEPOTIPID        = 0,
                        RAFSIZ           = 0,
                        DURUMID          = 1,
                        SERVISID         = servisId,
                    };

                    refMr = defaultDepo.Update();
                }
                if (refMr.error())
                {
                    defaultDepo = null;
                }
            }
            return(defaultDepo);
        }
Exemplo n.º 3
0
        public static SERVISDEPORAFLAR CreateRaf(SERVISDEPOLAR depo, string strRaf, decimal servisId, MethodReturn mr = null)
        {
            SERVISDEPORAFLAR foundRaf = R.Query <SERVISDEPORAFLAR>(mr).First(t => t.SERVISDEPOID == depo.ID && t.AD == strRaf).createIsNull();

            if (mr.ok() && foundRaf.IsNew())
            {
                decimal seqId = Convert.ToDecimal(SasonBase.SasonBaseApplicationPool.Get.EbaTestConnector.ExecuteScalar("select SERVISDEPORAFLAR_SEQ.NEXTVAL from dual", mr));
                if (mr.ok())
                {
                    foundRaf.ID           = seqId;
                    foundRaf.KOD          = strRaf;
                    foundRaf.AD           = strRaf;
                    foundRaf.SERVISDEPOID = depo.ID;
                    foundRaf.DURUMID      = 1;

                    mr = foundRaf.Update();
                }
            }
            return(foundRaf);
        }