protected void imgSaveOnly_Click(object sender, ImageClickEventArgs e) { if (FileUpload1.HasFile) { cefUser objEfUser = new cefUser(); //var extention = System.IO.Path.GetExtension(FileUpload1.FileName); //var strFilename = System.IO.Path.GetFileName(FileUpload1.FileName); var fileSize = FileUpload1.FileBytes; if (fileSize.Length <= (1024 * 1024 * 1)) { if (FileUpload1.PostedFile.ContentType.IndexOf("image", StringComparison.Ordinal) != -1) { if (objEfUser.SP_USER_SIGN_UPDATE(ViewState["person_code"].ToString(), FileUpload1.FileBytes)) { string strScript = "alert('บันทึกข้อมูลสมบูรณ์');ClosePopUp('" + ViewState["show"] + "');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "UploadFilePage", strScript, true); } } else { MsgBox("ไฟล์ที่เลือกไม่ใช่รูปภาพ โปรดตรวจสอบ"); } } else { MsgBox("ไฟล์มีขนาดใหญ่กว่า 1 MB โปรดตรวจสอบ"); } } }
protected void GenMenu() { cefUser objEfUser = new cefUser(); DataTable dtList = new DataTable(); DataTable dt = new DataTable(); DataRow[] drMenu; DataRow[] drMenu_sub; try { string strCriteria = string.Empty; strCriteria = " And MenuParent = 0 "; strCriteria += " And UserGroupCode= '" + Session["UserGroupCode"] + "'"; strCriteria += " And CanView= 'Y' "; strCriteria += " Order by MenuOrder "; dtList = objEfUser.SP_USER_GROUP_MENU_SEL(strCriteria); strCriteria = " And UserGroupCode='" + Session["UserGroupCode"] + "' "; strCriteria += " And CanView= 'Y' "; strCriteria += " Order by MenuOrder "; dt = objEfUser.SP_USER_GROUP_MENU_SEL(strCriteria); ASPxMenu1.Items.Clear(); for (int i = 0; i < dtList.Rows.Count; i++) { var menuItem = new DevExpress.Web.ASPxMenu.MenuItem(); menuItem.Text = dtList.Rows[i]["MenuName"].ToString(); menuItem.NavigateUrl = dtList.Rows[i]["MenuNavigationUrl"].ToString(); menuItem.Image.Url = Helper.CStr(dtList.Rows[i]["MenuImageUrl"].ToString()); drMenu = dt.Select("MenuParent=" + dtList.Rows[i]["MenuID"].ToString()); for (int j = 0; j < drMenu.Length; j++) { var menuItem_sub = new DevExpress.Web.ASPxMenu.MenuItem(); menuItem_sub.Text = drMenu[j]["MenuName"].ToString(); menuItem_sub.NavigateUrl = drMenu[j]["MenuNavigationUrl"].ToString(); menuItem_sub.Image.Url = drMenu[j]["MenuImageUrl"].ToString(); drMenu_sub = dt.Select("MenuParent=" + drMenu[j]["MenuID"].ToString()); for (int k = 0; k < drMenu_sub.Length; k++) { var menuItem_sub2 = new DevExpress.Web.ASPxMenu.MenuItem(); menuItem_sub2.Text = drMenu_sub[k]["MenuName"].ToString(); menuItem_sub2.NavigateUrl = drMenu_sub[k]["MenuNavigationUrl"].ToString(); menuItem_sub2.Image.Url = drMenu_sub[k]["MenuImageUrl"].ToString(); menuItem_sub.Items.Add(menuItem_sub2); } menuItem.Items.Add(menuItem_sub); } ASPxMenu1.Items.Add(menuItem); } } catch (Exception ex) { MsgBox(ex.Message); } finally { dtList.Dispose(); objEfUser.Dispose(); } }
private void CheckPermissionButton() { cefUser objEfUser = new cefUser(); _strMessage = string.Empty; _strCriteria = " and UserGroupCode = '" + base.UserGroupCode + "' " + " and [MenuNavigationUrl] in ('~/App_Control/open/open_list.aspx' , '~/App_Control/loan/loan_list.aspx' , '~/App_Control/open/open_approve_list.aspx') and CanView = 'Y' "; DataTable dtTemp = objEfUser.SP_USER_GROUP_MENU_SEL(_strCriteria); pnlApprove.Visible = false; pnlLoan.Visible = false; pnlOpen.Visible = false; foreach (DataRow dr in dtTemp.Rows) { if (dr["MenuNavigationUrl"].ToString() == "~/App_Control/open/open_list.aspx") { pnlOpen.Visible = true; } else if (dr["MenuNavigationUrl"].ToString() == "~/App_Control/loan/loan_list.aspx") { pnlLoan.Visible = true; } else if (dr["MenuNavigationUrl"].ToString() == "~/App_Control/open/open_approve_list.aspx") { pnlApprove.Visible = true; } } }
private bool saveData() { bool blnResult = false; cefUser objEfUser = new cefUser(); try { string strCanView; string strCanInsert; string strCanEdit; string strCanDelete; string strCanApprove; string strCanExtra; if (objEfUser.SP_USER_GROUP_MENU_DEL(cboUserGroup.SelectedValue)) { foreach (GridViewRow row in GridView1.Rows) { HiddenField hddMenuID = (HiddenField)row.FindControl("hddMenuID"); CheckBox chkCanView = (CheckBox)row.FindControl("chkCanView"); CheckBox chkCanInsert = (CheckBox)row.FindControl("chkCanInsert"); CheckBox chkCanEdit = (CheckBox)row.FindControl("chkCanEdit"); CheckBox chkCanDelete = (CheckBox)row.FindControl("chkCanDelete"); CheckBox chkCanApprove = (CheckBox)row.FindControl("chkCanApprove"); CheckBox chkCanExtra = (CheckBox)row.FindControl("chkCanExtra"); int intMenuId = Helper.CInt(hddMenuID.Value); strCanView = chkCanView.Checked ? "Y" : "N"; strCanInsert = chkCanInsert.Checked ? "Y" : "N"; strCanEdit = chkCanEdit.Checked ? "Y" : "N"; strCanDelete = chkCanDelete.Checked ? "Y" : "N"; strCanApprove = chkCanApprove.Checked ? "Y" : "N"; strCanExtra = chkCanExtra.Checked ? "Y" : "N"; objEfUser.SP_USER_GROUP_MENU_INS(cboUserGroup.SelectedValue, intMenuId, strCanView, strCanInsert, strCanEdit, strCanDelete, strCanApprove, strCanExtra); } } blnResult = true; MsgBox("บันทึกข้อมูลสมบูรณ์"); } catch (Exception ex) { blnResult = false; lblError.Text = ex.Message; } finally { objEfUser.Dispose(); } return(blnResult); }
private bool saveData() { bool blnResult = false; string strUpdatedBy = string.Empty; string struser_group_list = string.Empty; strUpdatedBy = Session["username"].ToString(); CheckBox chkSelect; HiddenField hddg_code; foreach (GridViewRow gvRow in GridView1.Rows) { chkSelect = (CheckBox)gvRow.FindControl("chkSelect"); hddg_code = (HiddenField)gvRow.FindControl("hddg_code"); if (chkSelect.Checked) { struser_group_list += hddg_code.Value + ","; } } if (struser_group_list.Length > 0) { struser_group_list = struser_group_list.Substring(0, struser_group_list.Length - 1); } var objEfUser = new cefUser(); try { #region update if (objEfUser.SP_PERSON_USER_GROUP_UPD(hddperson_code.Value, struser_group_list, txtperson_code.Text, strUpdatedBy)) { blnResult = true; } #endregion } catch (Exception ex) { lblError.Text = ex.Message; } finally { objEfUser.Dispose(); } return(blnResult); }
private void BindGridView() { cefUser objEfUser = new cefUser(); DataTable dt = new DataTable(); try { dt = objEfUser.SP_USER_GROUP_MENU_GROUP(cboUserGroup.SelectedValue); GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; imgSaveOnly.Visible = true; } catch (Exception ex) { lblError.Text = ex.Message; } finally { objEfUser.Dispose(); } }
public void InitUserAccessRight(string pUserGroupCode) { cefUser objEfUserMenu = new cefUser(); DataTable table = new DataTable(); try { string currentUrl = this.PermissionURL == "" ? this.GetCurrentUrl() : this.PermissionURL; currentUrl = Server.UrlDecode(currentUrl); string strCriteria = string.Empty; strCriteria = " And MenuNavigationUrl='" + currentUrl + "' and UserGroupCode = '" + pUserGroupCode + "' "; table = objEfUserMenu.SP_USER_GROUP_MENU_SEL(strCriteria); if (table.Rows.Count > 0) { IsUserView = false; IsUserNew = false; IsUserEdit = false; IsUserDelete = false; IsUserApprove = false; IsUserExtra = false; DataRow rowArray = table.Rows[0]; string str6 = rowArray["CanView"].ToString(); string str5 = rowArray["CanInsert"].ToString(); string str3 = rowArray["CanEdit"].ToString(); string str2 = rowArray["CanDelete"].ToString(); string str = rowArray["CanApprove"].ToString(); string str4 = rowArray["CanExtra"].ToString(); if (str6 == "N") { Session["error_message"] = "คุณไม่มีสิทธิ์ในการใช้งานเมนู : " + rowArray["MenuName"].ToString(); } if (str6 == "Y") { IsUserView = true; } if (str5 == "Y") { IsUserNew = true; } if (str3 == "Y") { IsUserEdit = true; } if (str2 == "Y") { IsUserDelete = true; } if (str == "Y") { IsUserApprove = true; } if (str4 == "Y") { IsUserExtra = true; } PageTitle = rowArray["MenuName"] + " (" + ProgramVersion + ")"; PageDes = rowArray["MenuName"].ToString(); } } catch (Exception ex) { table.Dispose(); } }