コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                DataTable dt = Helper.Helper.GetEselonList();
                if (User.IsInRole("MIA"))
                {
                    MembershipHelper.GetCurrentUser();
                    DataTable parentID = Helper.Helper.GetUserParentDepartemen(User.Identity.Name);
                    var       rows     =
                        dt.AsEnumerable().Cast <DataRow>().Where(x =>
                                                                 x.Field <string>("KD_UNIT_ORG") == parentID.Rows[0]["KD_UNIT_ORG"].ToString());
                    dt = !rows.Any() ? null : rows.CopyToDataTable();
                }

                #region refactored

                /*
                 * RadComboBox1.DataSource = dt;
                 *
                 * //RadComboBox1.DataSource = Helper.Helper.GetEselonList();
                 * RadComboBox1.AllowCustomText = true;
                 * RadComboBox1.MarkFirstMatch = true;
                 * RadComboBox1.Filter = RadComboBoxFilter.Contains;
                 * RadComboBox1.EmptyMessage = "[Pilih Bidang]";
                 * RadComboBox1.SelectedIndex = 0;
                 * RadComboBox1.DataBind();
                 */
                #endregion

                Helper.Helper.PopuplateCombobox(RadComboBox1, dt, "NM_UNIT_ORG", "KD_UNIT_ORG", "[Pilih Bidang]");
                Helper.Helper.PopulateCmbPeriode(rdPeriode);
            }
        }
コード例 #2
0
        protected void RadTreeList1_NeedDataSource(object sender, Telerik.Web.UI.TreeListNeedDataSourceEventArgs e)
        {
            DataTable dt = GetPivotData(RadComboBox1.SelectedValue);

            //RadTreeList1.DataSource = GetPivotData(RadComboBox1.SelectedValue);

            if (User.IsInRole("MIA"))
            {
                MembershipHelper.GetCurrentUser();

                var rows =
                    dt.AsEnumerable().Cast <DataRow>().Where(x =>
                                                             x.Field <string>("KD_UNIT") == Session["User.DeptID"].ToString() ||
                                                             x.Field <string>("KD_PARENT") == Session["User.DeptID"].ToString()
                                                             );

                foreach (DataRow row in rows)
                {
                    if (row["KD_UNIT"].ToString() == Session["User.DeptID"].ToString())
                    {
                        row["KD_PARENT"] = "";
                    }
                }

                dt = !rows.Any() ? null : rows.CopyToDataTable();
            }

            RadTreeList1.DataSource = dt;
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (MembershipHelper.GetCurrentUser() == null)
         {
             Response.Redirect("login.aspx");
         }
     }
 }
コード例 #4
0
        protected void grid_binding(object sender, GridNeedDataSourceEventArgs e)
        {
            DataTable dt = GetDashboardRKP();

            if (User.IsInRole("MIA"))
            {
                MembershipHelper.GetCurrentUser();
                var rows = dt.AsEnumerable()
                           .Where(x => x.Field <string>("Unit") == Session["User.Dept"].ToString());
                dt = !rows.Any() ? null : rows.CopyToDataTable();
            }
            RadGrid1.DataSource = dt;
        }
コード例 #5
0
ファイル: LaporanIku.aspx.cs プロジェクト: respatiapp/SIMPEL
        protected void grid_binding(object sender, GridNeedDataSourceEventArgs e)
        {
            string pfm_id = rdPeriode.SelectedValue;

            DataTable dt = GetLaporanIku(pfm_id).Tables[0];

            if (User.IsInRole("MIA"))
            {
                MembershipHelper.GetCurrentUser();
                if (dt != null)
                {
                    var rows = dt.AsEnumerable().Cast <DataRow>().Where(x =>
                                                                        x.Field <string>("Nama Satuan Kerja") == Session["User.Dept"].ToString());
                    dt = !rows.Any() ? null : rows.CopyToDataTable();
                }
            }
            RadGrid1.DataSource = dt;
        }
コード例 #6
0
        public static string ChangePassword(string oldpassword, string newpassword)
        {
            MembershipUser user = Membership.GetUser(MembershipHelper.GetCurrentUser().UserName);

            if (user != null && Membership.ValidateUser(user.UserName, oldpassword))
            {
                if (user.ChangePassword(oldpassword, newpassword))
                {
                    return("Pergantian kata sandi berhasil");
                }
                else
                {
                    return("Pergantian kata sandi gagal");
                }
            }
            else
            {
                return("Kata sandi lama salah");
            }
        }
コード例 #7
0
 public static string Save(string data)
 {
     try
     {
         Scheduler scheduler = JsonConvert.DeserializeObject <Scheduler>(data);
         scheduler.created_by = MembershipHelper.GetCurrentUser().UserName;
         DataTable dt = Helper.Helper.InsertSetting(scheduler);
         return(JsonConvert.SerializeObject(
                    new JsonResult()
         {
             isSuccess = true, message = dt.Rows[0]["id"].ToString()
         }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new JsonResult()
         {
             isSuccess = false, message = ex.ToString()
         }));
     }
 }