Exemple #1
0
        public static IEnumerable <Ordersampletbl> GetDataByStatus(string Status, string Lab = "")
        {
            try
            {
                using (var db = new smlpobDB())
                {
                    var datas = new List <Ordersampletbl>();
                    if (!string.IsNullOrEmpty(Lab))
                    {
                        datas = db.Ordersampletbl.Include(c => c.OrderNoNavigation).Where(x => x.OrderNoNavigation.Status == Status && x.OrderNoNavigation.AnalysisType == Lab)
                                .AsNoTracking()
                                .ToList();
                    }
                    else
                    {
                        datas = db.Ordersampletbl.Include(c => c.OrderNoNavigation).Where(x => x.OrderNoNavigation.Status == Status)
                                .AsNoTracking()
                                .ToList();
                    }

                    return(datas);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = typeof(OrderSampleControls).Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(null);
        }
Exemple #2
0
 bool IsAuthorized()
 {
     if (!string.IsNullOrEmpty(Roles))
     {
         using (var db = new smlpobDB())
         {
             var uname  = CommonWeb.GetCurrentUser();
             var MyRole = (from x in db.accounttbls
                           where x.username == uname
                           select x).ToList();
             if (MyRole != null)
             {
                 foreach (var item in Roles.Split(';'))
                 {
                     foreach (var my in MyRole)
                     {
                         if (item == my.roleName)
                         {
                             return(true);
                         }
                     }
                 }
             }
         }
         return(false);
     }
     else
     {
         return(true);
     }
 }
        public string GetExteRate(string elementservice, int comoditynum)
        {
            try
            {
                using (var contex = new smlpobDB())
                {
                    var data = (from x in contex.elementservicestbls
                                where x.elementCode == elementservice && x.comodityNo == comoditynum
                                select x.ExtractionId).FirstOrDefault();
                    if (data != null)
                    {
                        int exid = Int32.Parse(data);
                        var prep = (from x in contex.elementservicestbls
                                    where x.elementid == exid
                                    select x.serviceRate).FirstOrDefault().ToString();
                        return(prep);
                    }
                    return(data);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = currentUser;
                LogHelpers.WriteLog();
            }

            return(null);
        }
        public async Task <IEnumerable <customertbl> > GetDataByContaint(string param)
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var datas = await(from x in context.customertbls
                                      where x.customerName.Contains(param) ||
                                      x.customerEmail.Contains(param) ||
                                      x.companyName.Contains(param) ||
                                      x.companyEmail.Contains(param)
                                      select x).ToListAsync();
                    return(datas);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(null);
        }
        public async Task <bool> UpdateData(string id, Standardtbl obj)
        {
            try
            {
                if (id != obj.StdId.ToString())
                {
                    return(false);
                }

                using (var context = new smlpobDB())
                {
                    context.Standardtbl.Attach(obj);
                    context.Entry(obj).Property(x => x.StdNo).IsModified      = true;
                    context.Entry(obj).Property(x => x.ComodityNo).IsModified = true;
                    context.Entry(obj).Property(x => x.ModBy).IsModified      = true;
                    context.Entry(obj).Property(x => x.ModDate).IsModified    = true;
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(false);
        }
        public async Task <IEnumerable <standarddetailtbl> > GetParameterUji(string childkomoditas, string tipeanalis)
        {
            try
            {
                int no = 0;
                int.TryParse(childkomoditas, out no);
                using (var context = new smlpobDB())
                {
                    var datas = await(from x in context.standarddetailtbls
                                      .Include("standardtbl")
                                      .Include("elementservicestbl")
                                      where x.standardtbl.comodityNo == no &&
                                      x.elementservicestbl.serviceStatus == "Tersedia" &&
                                      x.elementservicestbl.analysisTypeName == tipeanalis
                                      select x).AsNoTracking().ToListAsync();

                    return(datas);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = currentUser;
                LogHelpers.WriteLog();
            }

            return(null);
        }
Exemple #7
0
        public bool UpdatePayment(string orderNo, string StatusPembayaran, string TipePembayaran)
        {
            try
            {
                using (var db = new smlpobDB())
                {
                    var selMaster = (from x in db.ordermastertbls
                                     where x.orderNo == orderNo
                                     select x).FirstOrDefault();
                    if (selMaster != null)
                    {
                        selMaster.paymentStatus = StatusPembayaran;
                        selMaster.statusType    = TipePembayaran;

                        if (StatusPembayaran != "Belum dibayar")
                        {
                            selMaster.status = "Barcode Sampel";
                            selMaster.isPaid = "1";
                        }
                        else
                        {
                            selMaster.isPaid = "0";
                        }
                        db.SaveChanges();
                    }
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public async Task <bool> DeleteData(string id)
        {
            int no = 0;

            int.TryParse(id, out no);

            try
            {
                using (var context = new smlpobDB())
                {
                    var datas = from x in context.comoditytbls
                                where x.comodityNo == no
                                select x;
                    foreach (var item in datas)
                    {
                        context.comoditytbls.Remove(item);
                    }
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }
            return(false);
        }
Exemple #9
0
        public async Task <IEnumerable <ordermastertbl> > GetDataKasir()
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var datas = await context.ordermastertbls
                                .Include(c => c.customertbl)
                                .Include(c => c.comoditytbl)
                                .Where(x => x.paymentStatus == "Belum dibayar" && x.status == "Pesanan Baru").AsNoTracking()
                                .ToListAsync();

                    return(datas);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(null);
        }
Exemple #10
0
        public async Task <bool> UpdateStatus(string id, string status)
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var isExist = await context.ordermastertbls.FindAsync(id);

                    if (isExist == null)
                    {
                        return(false);
                    }

                    var obj = isExist;
                    obj.status = status;

                    context.ordermastertbls.Attach(obj);
                    context.Entry(obj).Property(x => x.status).IsModified  = true;
                    context.Entry(obj).Property(x => x.modBy).IsModified   = true;
                    context.Entry(obj).Property(x => x.modDate).IsModified = true;
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(false);
        }
Exemple #11
0
        public async Task <bool> DeleteData(string id)
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var datas = from x in context.ordermastertbls
                                where x.orderNo == id
                                select x;
                    foreach (var item in datas)
                    {
                        context.ordermastertbls.Remove(item);
                    }
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }
            return(false);
        }
        public async Task <bool> UpdateData(string id, Employeetbl obj)
        {
            try
            {
                if (id != obj.EmployeeNo.ToString())
                {
                    return(false);
                }

                using (var context = new smlpobDB())
                {
                    context.Employeetbl.Attach(obj);
                    context.Entry(obj).Property(x => x.EmployeeName).IsModified         = true;
                    context.Entry(obj).Property(x => x.Position).IsModified             = true;
                    context.Entry(obj).Property(x => x.EmployeeEmail).IsModified        = true;
                    context.Entry(obj).Property(x => x.DerivativeToEmployee).IsModified = true;
                    context.Entry(obj).Property(x => x.AccountNo).IsModified            = true;
                    context.Entry(obj).Property(x => x.ModBy).IsModified   = true;
                    context.Entry(obj).Property(x => x.ModDate).IsModified = true;
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(false);
        }
        public async Task <IEnumerable <Employeetbl> > GetDataAnalis(string Lab = "")
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var datas = new List <Employeetbl>();
                    if (!string.IsNullOrEmpty(Lab))
                    {
                        datas = await context.Employeetbl.Include(c => c.Laboratorium).Where(x => x.Position == "penyelia" && x.Laboratorium.LaboratoriumName == Lab).AsNoTracking().ToListAsync();
                    }
                    else
                    {
                        datas = await context.Employeetbl.Where(x => x.Position == "penyelia").AsNoTracking().ToListAsync();
                    }

                    return(datas);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(null);
        }
 public static string GetUserLab(string username)
 {
     try
     {
         /*
          * if (!IsForce)
          * {
          *  if (HttpContext.Current.Session["MyLab"] != null)
          *      return HttpContext.Current.Session["MyLab"].ToString();
          * }*/
         var LabName = "";
         //var uname = GetCurrentUser();
         using (var db = new smlpobDB())
         {
             LabName = (from x in db.Employeetbl.Include(c => c.Laboratorium)
                        where x.EmployeeEmail == username
                        select x.Laboratorium.LaboratoriumName).FirstOrDefault();
             //HttpContext.Current.Session["MyLab"] = LabName;
         }
         return(LabName);
     }
     catch
     {
         return("");
     }
 }
Exemple #15
0
        private void GvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            var IDS = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "lihat":
                Response.Redirect("ManagerDetailOrder.aspx?value=" + IDS + "&State=" + FormState);
                break;

            case "rincian":
                Response.Redirect("ManagerDetailOrder.aspx?value=" + IDS + "&State=" + FormState);
                break;

            case "download":
                using (var db = new smlpobDB())
                {
                    var data = (from x in db.ordermastertbls where x.orderNo == IDS select x).FirstOrDefault();
                    if (data != null && !string.IsNullOrEmpty(data.LHPAttachmentUrl))
                    {
                        Response.Redirect(data.LHPAttachmentUrl);
                    }
                    else
                    {
                        CommonWeb.Alert(this, "File LHP tidak ditemukan.");
                    }
                }

                break;

            case "approval":
                Response.Redirect("ManagerDetailOrder.aspx?value=" + IDS + "&State=" + FormState);
                break;
            }
        }
Exemple #16
0
 public long GetLastNumber(string NameSet)
 {
     lock (locker)
     {
         try
         {
             using (var db = new smlpobDB())
             {
                 var data = (from x in db.autonumbertbls
                             where x.NameSet == NameSet
                             select x).FirstOrDefault();
                 if (data != null)
                 {
                     return(data.LastCounter);
                 }
                 else
                 {
                     return(0);
                 }
             }
         }
         catch
         {
             return(0);
         }
     }
 }
        public async Task <bool> AddData(Standarddetailtbl obj)
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var isExsist = (from x in context.Standarddetailtbl
                                    where x.ElementId == obj.ElementId &&
                                    x.StdId == obj.StdId
                                    select x).SingleOrDefault();

                    if (isExsist != null)
                    {
                        return(false);
                    }

                    context.Standarddetailtbl.Add(obj);
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(false);
        }
        public async Task <Standardtbl> DetailData(string id)
        {
            int no = 0;

            int.TryParse(id, out no);

            try
            {
                using (var context = new smlpobDB())
                {
                    var data = await context.Standardtbl
                               .Where(x => x.StdId == no)
                               .AsNoTracking()
                               .FirstOrDefaultAsync();

                    return(data);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(null);
        }
        public async Task <IEnumerable <ordermastertbl> > GetData()
        {
            try
            {
                using (var context = new smlpobDB())
                {
                    var datas = await context.ordermastertbls
                                .Include(c => c.comoditytbl)
                                //.Include(c => c.)
                                //.Include(c => c.)
                                //.Include(c => c.sampleNo)
                                .AsNoTracking()
                                .ToListAsync();

                    return(datas);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(null);
        }
 public static string GetCurrentUserName(string username)
 {
     try
     {
         var fName = "anonymous";
         //var uname = GetCurrentUser();
         using (var db = new smlpobDB())
         {
             var UserFullName = (from x in db.Customertbl
                                 where x.CustomerEmail == username
                                 select x.CustomerName).FirstOrDefault();
             if (UserFullName != null)
             {
                 fName = UserFullName;
             }
             else
             {
                 UserFullName = (from x in db.Employeetbl
                                 where x.EmployeeEmail == username
                                 select x.EmployeeName).FirstOrDefault();
                 fName = UserFullName;
             }
         }
         return(fName);
     }
     catch
     {
         return("anonymous");
     }
 }
Exemple #21
0
        private void GvData3_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            var NoBalitTanah = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "DetailorderList":
                OrderListControls orderControls = new OrderListControls();
                var ret  = orderControls.GetParameter(NoBalitTanah);
                var data = ret.Result;

                DivRow9.Visible = true;
                DivRow8.Visible = true;
                DivRow7.Visible = true;


                DivRow1.Visible = false;
                DivRow2.Visible = false;
                DivRow3.Visible = false;
                DivRow4.Visible = false;
                //DivRow5.Visible = false;
                DivRow6.Visible = false;



                using (var db = new smlpobDB())
                {
                    orderNo = Request.QueryString["orderNo"];
                    var headerInfo = (from x in db.ordersampletbls
                                      where x.orderNo == orderNo
                                      select x).FirstOrDefault();

                    if (headerInfo != null)
                    {
                        TxtNoSample.Text     = headerInfo.sampleCode;
                        TxtNoBalitTanah.Text = headerInfo.noBalittanah;
                        TxtDesa.Text         = headerInfo.village;
                        TxtKecamatan.Text    = headerInfo.subDistrict;
                        TxtKabupaten.Text    = headerInfo.district;
                        TxtPropinsi.Text     = headerInfo.province;
                        TxtGps.Text          = headerInfo.latitude + "," + headerInfo.longitude;
                        TxtTipeTanah.Text    = headerInfo.landUse;
                    }
                }



                GvParameter.DataSource = data.ToList();
                GvParameter.DataBind();
                if (GvParameter.Rows.Count > 0)
                {
                    GvParameter.UseAccessibleHeader    = true;
                    GvParameter.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                //Response.Redirect("DaftarService.aspx?orderNo=" + IDS);
                break;
            }
        }
Exemple #22
0
        private async void BtnSimpan_Click(object sender, EventArgs e)
        {
            try
            {
                var db        = new smlpobDB();
                var newDetail = db.orderanalysisdetailtbls.Where(x => x.sampleNo == txtNoBalitTanah.Text && x.elementId.ToString() == CmbParameter.SelectedValue).FirstOrDefault();

                if (FileUploadManual.HasFile && newDetail != null)
                {
                    string nameFile = "manual_" + CommonWeb.GetCurrentUser()
                                      + "_" + DateTime.Now.ToString("ddMMMyyyy")
                                      + "_" + shortid.ShortId.Generate(true, false)
                                      + Path.GetExtension(FileUploadManual.FileName);
                    await CloudStorage.BlobPostAsync(FileUploadManual.FileBytes, nameFile);

                    newDetail.fileName          = nameFile;
                    newDetail.fileAttachmentUrl = ConfigurationManager.AppSettings["DefaultBlobRootUrl"] + nameFile;
                }
                else
                {
                    CommonWeb.Alert(this, "Silakan lampirkan file perhitungan terlebih dahulu.");
                    return;
                }
                if (FileUploadAlat.HasFile && newDetail != null)
                {
                    string nameFile = "alat_" + CommonWeb.GetCurrentUser()
                                      + "_" + DateTime.Now.ToString("ddMMMyyyy")
                                      + "_" + shortid.ShortId.Generate(true, false)
                                      + Path.GetExtension(FileUploadAlat.FileName);
                    await CloudStorage.BlobPostAsync(FileUploadAlat.FileBytes, nameFile);

                    newDetail.LabToolFileName      = nameFile;
                    newDetail.LabToolAttachmentUrl = ConfigurationManager.AppSettings["DefaultBlobRootUrl"] + nameFile;
                }
                if (newDetail != null)
                {
                    newDetail.modDate = DateTime.Now;
                    newDetail.modBy   = CommonWeb.GetCurrentUser();
                    newDetail.status  = "Diproses";
                    await db.SaveChangesAsync();

                    ChangeOrderMasterStatus();
                    LoadData(txtNoBalitTanah.Text);
                    CommonWeb.Alert(this, "Data telah tersimpan");
                }
                else
                {
                    CommonWeb.Alert(this, "Gagal menyimpan, terjadi kesalahan.");
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().ToString();
                LogHelpers.message = "failed to post input parameter:" + ex.Message;
                LogHelpers.user    = CommonWeb.GetCurrentUser();
                LogHelpers.WriteLog();
            }
        }
        protected void ActionButton(object sender, EventArgs e)
        {
            try
            {
                var btn     = sender as Button;
                var command = btn.CommandName;

                switch (command)
                {
                case "Kembali":
                    DoKembali();
                    break;

                case "Approve":
                    DoContinue();

                    break;

                case "Reject":
                    using (var db = new smlpobDB())
                    {
                        var data = (from x in db.ordermastertbls.Include(c => c.employeetbl)
                                    where x.orderNo == txtNoOrder.Text
                                    select x).FirstOrDefault();
                        if (data != null)
                        {
                            data.status = "Hitung ulang";
                            db.SaveChanges();
                            //send to penyelia
                            var email = data.employeetbl.employeeEmail;
                            //var PhoneNo = data.employeetbl.employeePhone;
                            if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(TxtKeterangan.Text))
                            {
                                EmailService.SendEmail("Order No:" + txtNoOrder.Text + $" di Reject oleh Evaluator ({CommonWeb.GetCurrentUser()})", $"Order No {txtNoOrder.Text} di reject, dan perlu di hitung ulang dengan alasan {TxtKeterangan.Text}", email, true);
                                //SmsService.SendSms( $"Order No {txtNoOrder.Text} di reject, dan perlu di hitung ulang dengan alasan {TxtKeterangan.Text}", PhoneNo).GetAwaiter().GetResult();
                            }
                            else
                            {
                                CommonWeb.Alert(this, "Mohon isi keterangan.");
                            }
                        }
                        else
                        {
                            CommonWeb.Alert(this, "Gagal reject, terjadi kesalahan system.");
                        }
                        Response.Redirect("EvaluasiHasil.aspx");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().ToString();
                LogHelpers.message = "Terjadi kesalahan:" + ex.Message;
                LogHelpers.user    = CommonWeb.GetCurrentUser();
                LogHelpers.WriteLog();
            }
        }
        private void GvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Terima":
            {
                var payId = Convert.ToInt32(e.CommandArgument);
                PanelGridMasuk.Visible = false;
                DivPayment.Visible     = true;
                HidPaymentID.Value     = payId.ToString();
            }
            break;

            case "Tolak":
            {
                var payId = Convert.ToInt32(e.CommandArgument);
                using (var db = new smlpobDB())
                {
                    var payment = (from x in db.paymenttbls
                                   where x.paymentId == payId
                                   select x).FirstOrDefault();
                    if (payment != null)
                    {
                        var data = (from x in db.ordermastertbls
                                    where x.orderNo == payment.orderNo
                                    select x).FirstOrDefault();
                        if (data != null)
                        {
                            data.paymentStatus = Status.PaymentStatus[0];
                        }
                        payment.status = "Ditolak";
                        db.SaveChanges();
                        RefreshGrid();
                    }
                }
            }
            break;

            case "Lihat":
                var url = e.CommandArgument.ToString();
                Response.Write("<script>window.open ('" + url + "','_blank');</script>");
                break;

            case "Download":
                var DownloadUrl = e.CommandArgument.ToString();
                if (string.IsNullOrEmpty(DownloadUrl))
                {
                    CommonWeb.Alert(this, "Tidak ada lampiran");
                }
                else
                {
                    Response.Write("<script>window.open ('" + DownloadUrl + "','_blank');</script>");
                }
                break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GetTranslation();
            BtnCancel.Click += (a, b) => { DivPayment.Visible = false; PanelGridMasuk.Visible = true; };
            BtnSave.Click   += (a, b) =>
            {
                var payId = Convert.ToInt32(HidPaymentID.Value);
                using (var db = new smlpobDB())
                {
                    var payment = (from x in db.paymenttbls
                                   where x.paymentId == payId
                                   select x).FirstOrDefault();
                    if (payment != null)
                    {
                        var data = (from x in db.ordermastertbls
                                    where x.orderNo == payment.orderNo
                                    select x).FirstOrDefault();
                        if (data != null)
                        {
                            data.paymentStatus = Status.PaymentStatus[2];
                            data.isPaid        = "1";
                            data.paymentStatus = StatusPembayaranCmb.SelectedValue.ToString();
                            data.statusType    = TipePembayaranCmb.SelectedValue.ToString();
                            data.status        = Status.OrderStatus[1];
                        }
                        payment.status = "Diterima";
                        db.SaveChanges();
                        PanelGridMasuk.Visible = true;
                        DivPayment.Visible     = false;
                        RefreshGrid();
                        SendMailToCS(payment, data);
                    }
                }
            };
            GvData.RowDataBound += GvData_RowDataBound;
            GvData.RowCommand   += GvData_RowCommand;
            if (!IsPostBack)
            {
                StatusPembayaranCmb.Items.Clear();

                StatusPembayaranCmb.Items.Add(new ListItem(Status.PaymentStatus[2], Status.PaymentStatus[2]));
                StatusPembayaranCmb.Items.Add(new ListItem("DP", "DP"));
                TipePembayaranCmb.Items.Clear();
                TipePembayaranCmb.Items.Add(new ListItem("Penelitian", "Penelitian"));
                TipePembayaranCmb.Items.Add(new ListItem("PNBP", "PNBP"));
                TipePembayaranCmb.Items.Add(new ListItem("Khusus", "Khusus"));

                RefreshGrid();
            }

            this.GvData.DataBound += (object o, EventArgs ev) =>
            {
                GvData.HeaderRow.TableSection = TableRowSection.TableHeader;
            };
        }
 public AccountService()
 {
     if (db == null)
     {
         db = new smlpobDB();
     }
     if (enc == null)
     {
         enc = new Encryption();
     }
 }
Exemple #27
0
 void LoadData(string orderNo)
 {
     using (var db = new smlpobDB())
     {
         var dataSample = (from x in db.ordersampletbls
                           where x.orderNo == orderNo
                           select x).ToList();
         GvData.DataSource = dataSample;
         GvData.DataBind();
     }
 }
        protected async void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var    UploadFolder = HttpContext.Current.Server.MapPath("/Uploads");
                string nameFile     = userId + "_" + DateTime.Now.ToString("ddMMMyyyy") + Path.GetExtension(FileUpload1.FileName);
                //var fileName = Guid.NewGuid().ToString().Replace("-", "_") + Path.GetExtension(FileUpload1.FileName);
                var fullName = UploadFolder + "\\" + nameFile;

                if (FileUpload1.HasFile)
                {
                    await CloudStorage.BlobPostAsync(FileUpload1.FileBytes, nameFile);

                    var newDetail = new orderanalysisdetailtbl()
                    {
                    };
                    newDetail.fileName          = nameFile;
                    newDetail.fileAttachmentUrl = ConfigurationManager.AppSettings["DefaultBlobRootUrl"] + nameFile;
                    newDetail.modDate           = DateTime.Now;
                    newDetail.modBy             = CommonWeb.GetCurrentUser();
                    newDetail.orderDetailNo     = Convert.ToInt32(txtOrderDetailNo.Text);

                    var NewItem = new parameterstbl()
                    {
                    };
                    NewItem.string0 = txtBerat.Text;
                    NewItem.string1 = txtFP.Text;
                    NewItem.modDate = DateTime.Now;

                    context.parameterstbls.Add(NewItem);

                    using (var context = new smlpobDB())
                    {
                        context.orderanalysisdetailtbls.Attach(newDetail);
                        context.Entry(newDetail).Property(x => x.fileAttachmentUrl).IsModified = true;
                        context.Entry(newDetail).Property(x => x.fileName).IsModified          = true;
                        await context.SaveChangesAsync();
                    }

                    context.SaveChanges();
                    await CloudStorage.BlobPostAsync(FileUpload1.FileBytes, nameFile);

                    TxtStatus.Text = "Berhasil";

                    //FileUpload1.SaveAs(fullName);
                }
            }

            catch (Exception ex)
            {
                TxtStatus.Text = "gagal save --> " + ex.Message;
            }
        }
        public async Task <bool> UpdateData(string id, ordermastertbl obj)
        {
            try
            {
                if (id != obj.orderNo)
                {
                    return(false);
                }

                using (var context = new smlpobDB())
                {
                    context.ordermastertbls.Attach(obj);
                    context.Entry(obj).Property(x => x.orderNo).IsModified       = true;
                    context.Entry(obj).Property(x => x.customerNo).IsModified    = true;
                    context.Entry(obj).Property(x => x.comodityNo).IsModified    = true;
                    context.Entry(obj).Property(x => x.analysisType).IsModified  = true;
                    context.Entry(obj).Property(x => x.sampleTotal).IsModified   = true;
                    context.Entry(obj).Property(x => x.priceTotal).IsModified    = true;
                    context.Entry(obj).Property(x => x.statusType).IsModified    = true;
                    context.Entry(obj).Property(x => x.status).IsModified        = true;
                    context.Entry(obj).Property(x => x.paymentStatus).IsModified = true;
                    context.Entry(obj).Property(x => x.ppn).IsModified           = true;
                    //context.Entry(obj).Property(x => x.payment).IsModified = true;
                    context.Entry(obj).Property(x => x.receiptDate).IsModified         = true;
                    context.Entry(obj).Property(x => x.isPaid).IsModified              = true;
                    context.Entry(obj).Property(x => x.paymentDate).IsModified         = true;
                    context.Entry(obj).Property(x => x.pic).IsModified                 = true;
                    context.Entry(obj).Property(x => x.isOnLab).IsModified             = true;
                    context.Entry(obj).Property(x => x.ApprPenyelia).IsModified        = true;
                    context.Entry(obj).Property(x => x.ApprEvaluator).IsModified       = true;
                    context.Entry(obj).Property(x => x.ApprManagerTeknis).IsModified   = true;
                    context.Entry(obj).Property(x => x.LHPAttachmentUrl).IsModified    = true;
                    context.Entry(obj).Property(x => x.LHPFileName).IsModified         = true;
                    context.Entry(obj).Property(x => x.EvaluationFileName).IsModified  = true;
                    context.Entry(obj).Property(x => x.EvaluationFileUrl).IsModified   = true;
                    context.Entry(obj).Property(x => x.CalculationFilename).IsModified = true;
                    context.Entry(obj).Property(x => x.CalculationFileUrl).IsModified  = true;
                    await context.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.source  = this.GetType().Name;
                LogHelpers.message = ex.Message;
                LogHelpers.user    = "";
                LogHelpers.WriteLog();
            }

            return(false);
        }
Exemple #30
0
        void LoadGridSample(string orderNo)
        {
            try
            {
                var ret        = orderControls.GetDataDetail(orderNo);
                var dataSample = ret.Result;

                using (var db = new smlpobDB())
                {
                    var UrlToFile = (from x in db.ordermastertbls
                                     where x.orderNo == orderNo
                                     select x.LHPAttachmentUrl).FirstOrDefault();

                    if (!string.IsNullOrEmpty(UrlToFile))
                    {
                        ViewState["DownloadUrl"] = UrlToFile;
                        //BtnDownload.PostBackUrl = UrlToFile;
                    }
                    else
                    {
                        BtnDownloadZip.Visible  = false;
                        BtnDownloadZip2.Visible = true;
                    }
                }

                foreach (var data in dataSample)
                {
                    if (data.isReceived == "1")
                    {
                        data.isReceived = "Sudah";
                    }

                    else
                    {
                        data.isReceived = "Belum";
                    }
                }



                GvData.DataSource = dataSample;
                GvData.DataBind();


                if (GvData.Rows.Count > 0)
                {
                    GvData.UseAccessibleHeader    = true;
                    GvData.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
            }
            catch { }
        }