Example #1
0
        public static void SoftDeleteData(int id)
        {
            PenjaminanDatasetTableAdapters.m_workflowTableAdapter ta = new PenjaminanDatasetTableAdapters.m_workflowTableAdapter();
            PenjaminanDataset.m_workflowDataTable dt = ta.GetDataWprkflowByID(id);

            try
            {
                if (dt != null)
                {
                    dt[0].deleted = "1";

                    ta.Update(dt);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message, ex);
            }
        }
Example #2
0
        public static PenjaminanDataset.m_workflowRow selectWorkflowByID(int id)
        {
            PenjaminanDatasetTableAdapters.m_workflowTableAdapter ta = new PenjaminanDatasetTableAdapters.m_workflowTableAdapter();
            PenjaminanDataset.m_workflowDataTable dt = new PenjaminanDataset.m_workflowDataTable();
            PenjaminanDataset.m_workflowRow       dr = null;

            try
            {
                ta.FillWorkflowByID(dt, id);

                if (dt.Count > 0)
                {
                    dr = dt[0];
                }

                return(dr);
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Failed to load workflow data : " + ex.Message);
            }
        }
Example #3
0
        public static void UpdateData(int Id, int Sequence, string Name, string Description)
        {
            PenjaminanDatasetTableAdapters.m_workflowTableAdapter ta = new PenjaminanDatasetTableAdapters.m_workflowTableAdapter();
            PenjaminanDataset.m_workflowDataTable dt = ta.GetDataWprkflowByID(Id);

            try
            {
                if (dt != null)
                {
                    dt[0].name            = Name;
                    dt[0].sequence        = Sequence;
                    dt[0].description     = Description;
                    dt[0].lastupdatedby   = 1;
                    dt[0].lastupdateddate = DateTime.Now;

                    ta.Update(dt);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message, ex);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //inisiasi u/ kebuutuhan tbl t_workflow

            var user = (PenjaminanDataset.UserProfileRow)Session["UserProfile"];

            tSquence = Convert.ToInt32(user.role);
            int    tModeule = eID;
            string Module   = "mitra";
            int    tMwf     = 0;
            int    tUrutan1 = 0;
            int    tUrutan2 = 0;

            //buat validasi
            if (tSquence != 1)
            {
                tUrutan1 = tSquence - 1;
                Models.PenjaminanDatasetTableAdapters.m_workflowTableAdapter taVal1 = new Models.PenjaminanDatasetTableAdapters.m_workflowTableAdapter();
                PenjaminanDataset.m_workflowDataTable dtVal1   = taVal1.GetDataTwf(tUrutan1, Module);
                PenjaminanDataset.m_workflowDataTable dtModule = taVal1.GetDataModule(Module);

                foreach (PenjaminanDataset.m_workflowRow drX in taVal1.GetDataModule(Module))
                {
                    var pembanding = drX.sequence - 1;

                    //get data buat validasi jancuk
                    if (pembanding == tUrutan1)
                    {
                        Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter taVal2 = new Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter();
                        PenjaminanDataset.t_workflowDataTable dtVal2 = taVal2.GetDataValidasi(1, drX.sequence - 1, eID);
                        if (dtVal2.Count > 0)
                        {
                            tMwf = dtVal1[0].idModule;

                            Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter ta = new Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter();
                            PenjaminanDataset.t_workflowDataTable dtWF = ta.GetDataByforUpdateStatusMitra(tMwf, eID);

                            ta.Insert(tMwf, tModeule, drX.sequence, tSquence, "Y", textKeterangan.Value, user.id.ToString(), DateTime.Now, null, null, "0");

                            PenjaminanDataset.t_workflowDataTable dtWF2 = ta.GetDataByforUpdateStatusMitra(tMwf, eID);
                            string type = "aproove";
                            if (txtCalonMitra.Value == "")
                            {
                                throw new Exception("Field Calon Mitra is Mandatory");
                            }
                            //buat validasi apakah dia sudah terapprove semua atau tidak
                            if (dtModule.Count == dtWF2.Count)
                            {
                                m_mitra.UpdateStatus(eID, textKeterangan.Value, type);
                            }
                            Response.Redirect("/Penjaminan/ViewMitra.aspx");
                        }
                        else
                        {
                            string message = "Tidak Bisa Approve, karena level " + tUrutan1 + " Belum Approve!";
                            //ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + message + "');", true);
                            Response.Write("<script>alert('" + message + "');window.location = '/Penjaminan/ViewMitra.aspx';</script>");

                            //Response.Redirect("/Penjaminan/ViewMitra.aspx");
                        }
                    }
                }
            }
            else
            {
                Models.PenjaminanDatasetTableAdapters.m_workflowTableAdapter taVal1 = new Models.PenjaminanDatasetTableAdapters.m_workflowTableAdapter();
                PenjaminanDataset.m_workflowDataTable dtVal1 = taVal1.GetDataTwf(tSquence, Module);
                if (dtVal1.Count > 0)
                {
                    tMwf = dtVal1[0].id;

                    Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter ta = new Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter();

                    ta.Insert(tMwf, tModeule, tSquence, tSquence, "Y", textKeterangan.Value, user.id.ToString(), DateTime.Now, null, null, "0");

                    string type = "aproove";
                    if (txtCalonMitra.Value == "")
                    {
                        throw new Exception("Field Calon Mitra is Mandatory");
                    }
                    m_mitra.UpdateStatus(eID, textKeterangan.Value, type);

                    Response.Redirect("/Penjaminan/ViewMitra.aspx");
                }
            }
            ////buat dapetin fk_m_workflow
            //Models.PenjaminanDatasetTableAdapters.m_workflowTableAdapter tax = new Models.PenjaminanDatasetTableAdapters.m_workflowTableAdapter();
            //PenjaminanDataset.m_workflowDataTable dtX = tax.GetDataTwf(tSquence, Module);
            //if(dtX.Count > 0)
            //{
            //    tMwf = dtX[0].id;
            //}


            //Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter ta = new Models.PenjaminanDatasetTableAdapters.t_workflowTableAdapter();

            //ta.Insert(tMwf, tModeule, tSquence, "Y", textKeterangan.Value, user.id.ToString(), DateTime.Now, null, "0");

            //////buat validasi
            ////PenjaminanDataset.t_workflowDataTable dt = ta.GetDataforAction(tMwf, eID);
            ////if(dt.Count > 0)
            ////{
            ////    ta.Insert(tMwf, tModeule, tSquence, "Y", textKeterangan.Value, user.id.ToString(), DateTime.Now,null,"0");
            ////}

            //string type = "aproove";
            //if (txtCalonMitra.Value == "")
            //{
            //    throw new Exception("Field Calon Mitra is Mandatory");
            //}
            //m_mitra.UpdateStatus(eID,textKeterangan.Value, type);
        }