Esempio n. 1
0
        /// <summary>
        /// mendapatkan data options po
        /// </summary>
        /// <returns></returns>
        public PoOption getOption()
        {
            try
            {
                PoOption po = db.poOptionData.FirstOrDefault(p => p.po == _po);
                if (po != null)
                {
                    return po;
                }
                else
                {
                    return new PoOption()
                    {
                        amendment = false,
                        negotiation = false,
                        po_import = false
                    };
                }

            }
            catch (Exception e)
            {
                Log.Error(e);
                return new PoOption()
                {
                    amendment = false,
                    negotiation = false,
                    po_import = false
                };
            }
        }
Esempio n. 2
0
 /// <summary>
 /// perubahan tanggal jaminan
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public bool setDateOption(string name, DateTime value)
 {
     try
     {
         PoOption po = db.poOptionData.FirstOrDefault(p => p.po == _po);
         if (po == null)
         {
             po = new PoOption()
             {
                 po = _po
             };
             switch (name)
             {
                 case TGLUM:
                     po.tgl_um = value;
                     break;
                 case TGLPELAKSANAAN:
                     po.tgl_pelaksanaan = value;
                     break;
                 case TGLPEMELIHARAAN:
                     po.tgl_pemeliharaan = value;
                     break;
                 default:
                     break;
             }
             db.poOptionData.Add(po);
         }
         else
         {
             switch (name)
             {
                 case TGLUM:
                     po.tgl_um = value;
                     break;
                 case TGLPELAKSANAAN:
                     po.tgl_pelaksanaan = value;
                     break;
                 case TGLPEMELIHARAAN:
                     po.tgl_pemeliharaan = value;
                     break;
                 default:
                     break;
             }
         }
         db.SaveChanges();
         return true;
     }
     catch (Exception e)
     {
         Log.Error(e);
         return false;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// perubahan data options po
 /// </summary>
 /// <param name="name">nama jenis options</param>
 /// <param name="state">di ceklis atau tidak</param>
 /// <returns></returns>
 public bool setOption(string name, bool state)
 {
     try
     {
         PoOption po = db.poOptionData.FirstOrDefault(p => p.po == _po);
         if (po == null)
         {
             po = new PoOption()
             {
                 po = _po
             };
             switch (name)
             {
                 case AMANDEMEN:
                     po.amendment = state;
                     break;
                 case POIMPOR:
                     po.po_import = state;
                     break;
                 case NEGO:
                     po.negotiation = state;
                     break;
                 case JAMINANUM:
                     po.jaminan_um = state;
                     po.tgl_um = DateTime.Now;
                     break;
                 case JAMINANPELAKSANAAN:
                     po.jaminan_pelaksanaan = state;
                     po.tgl_pelaksanaan = DateTime.Now;
                     break;
                 case JAMINANPEMELIHARAAN:
                     po.jaminan_pemeliharaan = state;
                     po.tgl_pemeliharaan = DateTime.Now;
                     break;
                 case ISDONE:
                     po.is_done = state;
                     break;
                 default:
                     break;
             }
             db.poOptionData.Add(po);
         }
         else
         {
             switch (name)
             {
                 case AMANDEMEN:
                     po.amendment = state;
                     break;
                 case POIMPOR:
                     po.po_import = state;
                     break;
                 case NEGO:
                     po.negotiation = state;
                     break;
                 case JAMINANUM:
                     po.jaminan_um = state;
                     break;
                 case JAMINANPELAKSANAAN:
                     po.jaminan_pelaksanaan = state;
                     break;
                 case JAMINANPEMELIHARAAN:
                     po.jaminan_pemeliharaan = state;
                     break;
                 case ISDONE:
                     po.is_done = state;
                     break;
                 default:
                     break;
             }
         }
         db.SaveChanges();
         return true;
     }
     catch (Exception e)
     {
         Log.Error(e);
         return false;
     }
 }