Exemplo n.º 1
0
    public string[] GetEmpNameEnList(string prefixText, int count)
    {
        StringBuilder Q = new StringBuilder();

        Q.Append(" SELECT EmpNameEn FROM EmployeeMaster WHERE EmpNameEn IS NOT NULL AND EmpNameEn LIKE '%" + prefixText + "%'");

        List <string> items = new List <string>(count);
        DataTable     PDT   = DBFun.FetchData(Q.ToString());

        if (!DBFun.IsNullOrEmpty(PDT))
        {
            for (int i = 0; i < PDT.Rows.Count; i++)
            {
                items.Add(PDT.Rows[i][0].ToString());
            }
        }

        return(items.ToArray());
    }
Exemplo n.º 2
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string Q = " SELECT MacID FROM TransDump WHERE MacID = " + txtMachineID.Text + " ";

        dt = DBFun.FetchData(Q);
        if (!DBFun.IsNullOrEmpty(dt))
        {
            MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة"));
        }
        else
        {
            ProClass.MacID = txtMachineID.Text;
            SqlClass.Delete(ProClass);
            MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Machine deleted successfully", "تم حذف المكينة بنجاح"));

            ClearItem();
            Search();
        }
    }
Exemplo n.º 3
0
    public string[] GetVisMobileNoList(string prefixText, int count)
    {
        StringBuilder Q = new StringBuilder();

        Q.Append(" SELECT DISTINCT VisMobileNo FROM VisitorsCard WHERE VisMobileNo IS NOT NULL AND VisMobileNo LIKE '%" + prefixText + "%'");

        List <string> items = new List <string>(count);
        DataTable     PDT   = DBFun.FetchData(Q.ToString());

        if (!DBFun.IsNullOrEmpty(PDT))
        {
            for (int i = 0; i < PDT.Rows.Count; i++)
            {
                items.Add(PDT.Rows[i][0].ToString());
            }
        }

        return(items.ToArray());
    }
Exemplo n.º 4
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    protected void EmpName_ServerValidate(Object source, ServerValidateEventArgs e)
    {
        string sqlUpdate = ViewState["CommandName"].ToString() == "Edit" ? " AND EmpID != '" + txtEmpID.Text + "'": "";

        try
        {
            if (source.Equals(cvEmpNameAr))
            {
                if (string.IsNullOrEmpty(txtEmpNameAr.Text))
                {
                    General.ValidMsg(this, ref cvEmpNameAr, false,"Employee Name (Ar) is required!", "اسم الموظف بالعربي مطلوب !");
                    e.IsValid = false;
                    return;
                }
                else
                {
                    dt = DBFun.FetchData(MainQuery + " AND EmpNameAr = '" + txtEmpNameAr.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvEmpNameAr, true, General.Msg("Employee Name (Ar) already exists", "اسم الموظف بالعربي موجود مسبقا"));
                        e.IsValid = false;
                        return;
                    }
                }
            }

            if (source.Equals(cvEmpNameEn))
            {
                if (!string.IsNullOrEmpty(txtEmpNameEn.Text))
                {
                    dt = DBFun.FetchData(MainQuery + " AND EmpNameEn = '" + txtEmpNameEn.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvEmpNameEn, true, General.Msg("Employee Name (En) already exists", "اسم الموظف بالانجليزي موجود مسبقا"));
                        e.IsValid = false;
                        return;
                    }
                }
            }

        }
        catch { e.IsValid = false; }
    }
Exemplo n.º 5
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void FillGrid()
    {
        string EmpID   = ViewState["EmpID"].ToString();
        string EmpType = "";

        string selectQ = " SELECT CardID,EmpID,EmpNameEn,EmpNameAr,IsID,StartDate,ExpiryDate,CardStatus,InActiveStatus,IsApproved,isPrinted,EmpType "
                         + " , IsName" + General.Lang() + " AS IssueName "
                         + " FROM CardInfoView "
                         + " WHERE EmpID = '" + EmpID + "' ORDER BY CardID DESC";

        dt = DBFun.FetchData(selectQ);
        if (!DBFun.IsNullOrEmpty(dt))
        {
            txtEmpID.Text     = ViewState["EmpID"].ToString();
            txtEmpNameEn.Text = dt.Rows[0]["EmpNameEn"].ToString();
            txtEmpNameAr.Text = dt.Rows[0]["EmpNameAr"].ToString();
            EmpType           = dt.Rows[0]["EmpType"].ToString();

            grdData.DataSource = (DataTable)dt;
            grdData.DataBind();
            if (Request.QueryString["ac"].ToString() == "u")
            {
                PopulateUpdate(EmpID);
            }                                                                           //else { FindEmpType(EmpID, ""); }
        }
        else
        {
            ClearUI();
            FormCtrl.FillGridEmpty(ref grdData, 20, "This employee does not have cards", "هذا الموظف لا يملك بطاقات");
            DataTable Empdt = DBFun.FetchData("SELECT EmpID,EmpType,EmpNameEn,EmpNameAr FROM EmployeeInfoView WHERE EmpID = '" + EmpID + "'");
            if (!DBFun.IsNullOrEmpty(Empdt))
            {
                txtEmpID.Text     = EmpID;
                txtEmpNameEn.Text = Empdt.Rows[0]["EmpNameEn"].ToString();
                txtEmpNameAr.Text = Empdt.Rows[0]["EmpNameAr"].ToString();
                EmpType           = Empdt.Rows[0]["EmpType"].ToString();

                //FindEmpType(EmpID, "");
            }
        }

        SetTmp(EmpType);
    }
Exemplo n.º 6
0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public bool FindBlackList(string pID)
 {
     try
     {
         DataTable DT = DBFun.FetchData("SELECT BlaID FROM BlackList WHERE BlaIdentityNo = '" + pID + "'");
         if (!DBFun.IsNullOrEmpty(DT))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e1)
     {
         DBFun.InsertError(FormSession.PageName, "FindBlackList");
         return(false);
     }
 }
Exemplo n.º 7
0
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public string GetEmpName(string pEmpID, string pLang)
 {
     try
     {
         dt = DBFun.FetchData("Select EmpNameEn, EmpNameAr FROM EmployeeMaster WHERE EmpID = '" + pEmpID + "'");
         if (!DBFun.IsNullOrEmpty(dt))
         {
             if (pLang == "Ar")
             {
                 return(dt.Rows[0]["EmpNameAr"].ToString());
             }
             else
             {
                 return(dt.Rows[0]["EmpNameEn"].ToString());
             }
         }
         return(string.Empty);
     }
     catch (Exception e1) { return(string.Empty); }
 }
Exemplo n.º 8
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public string FindTmp()
    {
        try
        {
            string tmp = "0";

            DataTable TmpDT = DBFun.FetchData("SELECT * FROM CardTemplate WHERE TmpType = 'VCard'");
            if (!DBFun.IsNullOrEmpty(TmpDT))
            {
                tmp = TmpDT.Rows[0]["TmpID"].ToString();
            }

            return(tmp);
        }
        catch (Exception e1)
        {
            DBFun.InsertError(FormSession.PageName, "PopulateUI");
            return("0");
        }
    }
Exemplo n.º 9
0
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         divRole.Visible = true;
         if (ShowRole)
         {
             ddlRole.Visible = true;
         }
         else
         {
             ddlRole.Visible = false;
         }
         DataTable dt = DBFun.FetchData(" SELECT * FROM RoleUserPermissions ");
         if (!DBFun.IsNullOrEmpty(dt))
         {
             FormCtrl.PopulateDDL(ddlRole, dt, "RoleName" + General.Lang(), "RolePermissions", General.Msg("-Select Role Permissions-", "-اختر مجموعة الصلاحيات-"));
         }
     }
 }
Exemplo n.º 10
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void PopulateUI()
    {
        try
        {
            DataTable DT = DBFun.FetchData(GenralQuery);
            if (DBFun.IsNullOrEmpty(DT))
            {
                return;
            }

            txtEmlServerID.Text    = DT.Rows[0]["EmlServerID"].ToString();
            txtEmlPortNo.Text      = DT.Rows[0]["EmlPortNo"].ToString();
            txtEmlSenderEmail.Text = DT.Rows[0]["EmlSenderEmail"].ToString();
            txtEmlSenderPassword.Attributes["value"] = DT.Rows[0]["EmlSenderPassword"].ToString();
            cbEmlCredential.Checked     = Convert.ToBoolean(DT.Rows[0]["EmlCredential"]);
            cbEmlSsl.Checked            = Convert.ToBoolean(DT.Rows[0]["EmlSsl"]);
            txtEmlCountDaysForSend.Text = DT.Rows[0]["EmlCountDaysForSend"].ToString();
        }
        catch (Exception ex) { DBFun.InsertError(FormSession.PageName, "PopulateUI"); }
    }
Exemplo n.º 11
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void OldValidate_ServerValidate(Object source, ServerValidateEventArgs e)
    {
        try
        {
            if (source.Equals(cvOld))
            {
                if (string.IsNullOrEmpty(txtOldpassword.Text))
                {
                    MessageFun.ValidMsg(this, ref cvOld, false, General.Msg("Old Password is required", "كلمة المرور السابقة مطلوبة"));
                    e.IsValid = false;
                    return;
                }
                else
                {
                    if (FormSession.Role == "User")
                    {
                        dt = DBFun.FetchData("SELECT UsrPassword FROM AppUsers        WHERE UsrLoginID = '" + FormSession.LoginUsr + "'");
                    }
                    if (FormSession.Role == "Faculty")
                    {
                        dt = DBFun.FetchData("SELECT EmpPassword FROM EmployeeFaculty WHERE EmpLoginID = '" + FormSession.LoginUsr + "'");
                    }
                    if (FormSession.Role == "Officer")
                    {
                        dt = DBFun.FetchData("SELECT EmpPassword FROM EmployeeOfficer WHERE EmpLoginID = '" + FormSession.LoginUsr + "'");
                    }

                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        if (CryptorEngine.Decrypt(dt.Rows[0][0].ToString(), true) != txtOldpassword.Text)
                        {
                            MessageFun.ValidMsg(this, ref cvOld, true, General.Msg("The previous password is incorrect", "كلمة المرور السابقة غير صحيحة"));
                            e.IsValid = false;
                            return;
                        }
                    }
                }
            }
        }
        catch { e.IsValid = false; }
    }
Exemplo n.º 12
0
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 protected void PopulateData(string pID)
 {
     try
     {
         dt = DBFun.FetchData(MainQuery + " AND DepID = " + pID + "");
         if (DBFun.IsNullOrEmpty(dt))
         {
             return;
         }
         txtVtpID.Text     = dt.Rows[0]["DepID"].ToString();
         txtVtpNameAr.Text = dt.Rows[0]["DepNameAr"].ToString();
         txtVtpNameEn.Text = dt.Rows[0]["DepNameEn"].ToString();
         txtVtpDesc.Text   = dt.Rows[0]["DepDesc"].ToString();
         if (dt.Rows[0]["VtpStatus"] != DBNull.Value)
         {
             chkVtpStatus.Checked = Convert.ToBoolean(dt.Rows[0]["VtpStatus"]);
         }
         ButtonAction(true, "11100");
     }
     catch (Exception Ex) { }
 }
Exemplo n.º 13
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void PopulateUI(string Query)
    {
        try
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            dt = DBFun.FetchData(Query);
            if (!DBFun.IsNullOrEmpty(dt))
            {
                txtTableName.Text      = dt.Rows[0]["TableName"].ToString();
                txtEmpField.Text       = dt.Rows[0]["EmployeeField"].ToString();
                txtDateField.Text      = dt.Rows[0]["DateField"].ToString();
                txtTimeField.Text      = dt.Rows[0]["TimeField"].ToString();
                txtInOutField.Text     = dt.Rows[0]["InOutField"].ToString();
                txtMachineIdField.Text = dt.Rows[0]["MachineIdField"].ToString();
                txtLocationField.Text  = dt.Rows[0]["LocationField"].ToString();
                txtSchemaName.Text     = dt.Rows[0]["SchemaName"].ToString();
            }
        }
        catch (Exception Ex) { }
    }
Exemplo n.º 14
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void btnMainDelete_Click(object sender, EventArgs e)
    {
        string Q = " SELECT DepID FROM Department WHERE DepParentID = " + txtDepID.Text + " "
                   + " UNION SELECT DepID FROM EmployeesInfoView WHERE DepID = " + txtDepID.Text + " ";

        dt = DBFun.FetchData(Q);
        if (!DBFun.IsNullOrEmpty(dt))
        {
            MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة"));
        }
        else
        {
            ProClass.DepID = txtDepID.Text;
            SqlClass.Delete(ProClass);
            MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Department deleted successfully", "تم حذف القسم بنجاح"));

            ClearItem();
            Search();
            //FillSubGrid(SubQuery + " AND SdpID = -1");
        }
    }
Exemplo n.º 15
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public bool CheckFoundID(string pMaxID)
    {
        DataTable SDT = DBFun.FetchData("SELECT EmpID FROM EmployeeMaster WHERE EmpID = '" + pMaxID + "'");

        if (!DBFun.IsNullOrEmpty(SDT))
        {
            return(true);
        }
        else
        {
            return(false);
        }

        //DataTable SDT = DBFun.FetchData("SELECT BkdID FROM BookedID WHERE BkdID = '" + pMaxID + "'");
        //if (!DBFun.IsNullOrEmpty(SDT)) { return true; }
        //else
        //{
        //    SqlClass.Booked_Insert(pMaxID);

        //    return false;
        //}
    }
Exemplo n.º 16
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void PopulateData(string pID)
    {
        try
        {
            dt = DBFun.FetchData(MainQuery + " AND MacID = " + pID + "");
            if (DBFun.IsNullOrEmpty(dt))
            {
                return;
            }
            txtMachineID.Text      = dt.Rows[0]["MacID"].ToString();
            ddlMtpID.SelectedIndex = ddlMtpID.Items.IndexOf(ddlMtpID.Items.FindByValue(Convert.ToInt16(dt.Rows[0]["MtpID"]).ToString()));
            txtIPAddress.Text      = dt.Rows[0]["IPAddress"].ToString();
            if (dt.Rows[0]["MachineStatus"] != DBNull.Value)
            {
                chkMacStatus.Checked = Convert.ToBoolean(dt.Rows[0]["MachineStatus"]);
            }
            else
            {
                chkMacStatus.Checked = false;
            }
            txtPort.Text                = dt.Rows[0]["Port"].ToString();
            txtMachineNo.Text           = dt.Rows[0]["MachineNo"].ToString();
            txtMacSerialNo.Text         = dt.Rows[0]["MachineSerialNo"].ToString();
            txtMacLocationAr.Text       = dt.Rows[0]["LocationAr"].ToString();
            txtMacLocationEn.Text       = dt.Rows[0]["LocationEn"].ToString();
            ddlMacTrnType.SelectedIndex = ddlMacTrnType.Items.IndexOf(ddlMacTrnType.Items.FindByValue(Convert.ToInt16(dt.Rows[0]["MachineINOUTType"]).ToString()));
            if (dt.Rows[0]["MachineExport"] != DBNull.Value)
            {
                chkExportData.Checked = Convert.ToBoolean(dt.Rows[0]["MachineExport"]);
            }
            else
            {
                chkExportData.Checked = false;
            }

            ButtonAction(true, "11100");
        }
        catch (Exception Ex) { }
    }
Exemplo n.º 17
0
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 protected void btnSearchDetails_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtEmpIDSearch.Text))
     {
         dt = DBFun.FetchData("select * from EmployeeMaster WHERE EmpID = '" + txtEmpIDSearch.Text + "'");
         if (!DBFun.IsNullOrEmpty(dt))
         {
             string ID = hfdConnStr.Value + "%" + txtEmpIDSearch.Text + "%" + hfdLoginUser.Value + "%" + hfdLang.Value + "%" + hfdFile.Value;
             ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "Connect('" + ID + "');", true);
         }
         else
         {
             MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Employee ID does not exist,Please enter different ID", "رقم الموظف غير موجود,من فضلك اختر رقما آخر"));
             //string ID = hfdConnStr.Value + "%%" + hfdLoginUser.Value + "%" + hfdLang.Value + "%" + hfdFile.Value;
             //ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "Connect('" + ID + "');", true);
         }
     }
     else
     {
         General.ShowMsg(this, "You must enter the employee ID", "يجب إدخال رقم الموظف");
     }
 }
Exemplo n.º 18
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void rep_GetSubReport(object sender, StiGetSubReportEventArgs e)
    {
        string RepOrientation = ViewState["RepOrientation"].ToString();

        StiReport HRep = new StiReport();

        DataTable HDT = DBFun.FetchData(" SELECT * FROM Report WHERE RepType = 'Header' AND RepOrientation ='" + RepOrientation + "'");

        if (!DBFun.IsNullOrEmpty(HDT))
        {
            string RepHeader = HDT.Rows[0]["RepTemp" + FormSession.Language].ToString();

            if (e.SubReportName == "SubReport1")
            {
                HRep.LoadFromString(RepHeader);
            }

            HRep.Dictionary.Databases.Clear();
            HRep.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", General.ConnString));
            e.Report = HRep;
        }
    }
Exemplo n.º 19
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void lstReport_SelectedIndexChanged(object sender, EventArgs e)
    {
        Clear();

        StiWebViewerFx1.Report = null;
        btnEditReport.Enabled  = btnSetAsDefault.Enabled = btnViewreport.Enabled = false;

        //UpdatePanel1.Update();

        if (lstReport.SelectedIndex > -1)
        {
            string RepID       = lstReport.SelectedValue;
            string reportTitel = lstReport.SelectedItem.ToString();
            lblSelectedreport.Text = General.Msg("Report Selected : " + reportTitel, "التقرير المحدد : " + reportTitel);

            DataTable RepDT = DBFun.FetchData(" SELECT * FROM Report WHERE  RepID = '" + RepID + "'");
            if (!DBFun.IsNullOrEmpty(RepDT))
            {
                //RepDT.Rows[0]["RepID"].ToString()
                ViewState["RepID"]          = RepID;
                ViewState["ReportNameEn"]   = RepDT.Rows[0]["RepNameEn"].ToString();
                ViewState["ReportNameAr"]   = RepDT.Rows[0]["RepNameAr"].ToString();
                ViewState["pnlPermissions"] = Convert.ToInt32(RepDT.Rows[0]["RepPanels"]);

                int pnlPermissions = Convert.ToInt32(RepDT.Rows[0]["RepPanels"]);
                pnlDateFromTo.Visible = CheckBitWise(pnlPermissions, 1);
                pnlEmployee.Visible   = CheckBitWise(pnlPermissions, 2);
                pnlCreatedBy.Visible  = rvCreatedBy.Enabled = CheckBitWise(pnlPermissions, 4);
                pnlPrintedBy.Visible  = rvPrintedBy.Enabled = CheckBitWise(pnlPermissions, 8);
                pnlIssue.Visible      = rvIssue.Enabled = CheckBitWise(pnlPermissions, 16);
                pnlEmpType.Visible    = CheckBitWise(pnlPermissions, 32);

                FillPerm();

                btnViewreport.Enabled = true;
            }
        }
    }
Exemplo n.º 20
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public int FindCount(string pID)
    {
        int CardCount = 0;

        try
        {
            DataTable CountDT = DBFun.FetchData("SELECT COUNT(CardID) count FROM CardMaster WHERE isPrinted = 'True' AND EmpID = '" + pID + "'");
            if (DBFun.IsNullOrEmpty(CountDT))
            {
            }
            else
            {
                CardCount = Convert.ToInt32(CountDT.Rows[0]["count"]);
            }
        }
        catch (Exception Ex)
        {
            DBFun.InsertError(FormSession.PageName, "FindCount");
            MessageFun.ShowAdminMsg(this, Ex.Message);
        }

        return(CardCount);
    }
Exemplo n.º 21
0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         dt = DBFun.FetchData(" SELECT * FROM ApplicationSetup");
         if (!DBFun.IsNullOrEmpty(dt))
         {
             if (dt.Rows[0]["AppCalendar"].ToString() == "H")
             {
                 Session["DateFormat"] = "Hijri";
             }
             else
             {
                 Session["DateFormat"] = "Gregorian";
             }
         }
         UserLogin();
     }
     catch (Exception e1)
     {
         DBFun.InsertError("Login.aspx", "btnLogin");
     }
 }
Exemplo n.º 22
0
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public string GetCardInfo(string pCardID)
 {
     try
     {
         dt = DBFun.FetchData("SELECT ExpiryDate FROM CardMaster WHERE CardID = " + pCardID + "");
         if (!DBFun.IsNullOrEmpty(dt))
         {
             if (dt.Rows[0]["ExpiryDate"] != DBNull.Value)
             {
                 if (HttpContext.Current.Session["DateFormat"].ToString() == "Gregorian")
                 {
                     return((Convert.ToDateTime(dt.Rows[0]["ExpiryDate"])).ToString("dd/MM/yyyy"));
                 }
                 else if (HttpContext.Current.Session["DateFormat"].ToString() == "Hijri")
                 {
                     return(Convert.ToString(DateFun.GrnToHij(Convert.ToDateTime(dt.Rows[0]["ExpiryDate"]))));
                 }
             }
         }
         return(string.Empty);
     }
     catch (Exception e1) { return(string.Empty); }
 }
Exemplo n.º 23
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            StringBuilder QS = new StringBuilder();
            QS.Append(" SELECT * FROM AppUsers WHERE UsrLoginID = UsrLoginID ");

            if (!string.IsNullOrEmpty(txtUsrLoginID.Text))
            {
                QS.Append(" AND UsrLoginID   = '" + txtUsrLoginID.Text + "'");
            }
            if (!string.IsNullOrEmpty(txtUsrFullName.Text))
            {
                QS.Append(" AND UsrFullName LIKE '%" + txtUsrFullName.Text + "'");
            }
            if (!string.IsNullOrEmpty(txtUsrEmailID.Text))
            {
                QS.Append(" AND UsrEmailID   = '" + txtUsrEmailID.Text + "'");
            }
            if (ddlUsrStatus.SelectedIndex > 0)
            {
                QS.Append(" AND UsrStatus = '" + ddlUsrStatus.SelectedValue + "'");
            }
            dt = DBFun.FetchData(QS.ToString());
            if (!DBFun.IsNullOrEmpty(dt))
            {
                grdData.DataSource = (DataTable)dt;
                grdData.DataBind();
            }
            else
            {
                FormCtrl.FillGridEmpty(ref grdData, 20, "No records found with the given search criterion", "لا توجد سجلات بحسب شروط البحث المحددة");
            }
        }
        catch (Exception e1) { }
    }
Exemplo n.º 24
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void cvLocation_ServerValidate(Object source, ServerValidateEventArgs e)
    {
        string sqlUpdate = string.Empty;

        sqlUpdate = ViewState["CommandName"].ToString() == "Edit" ? " AND MacID != " + txtMachineID.Text : "";
        try
        {
            if (source.Equals(cvLocationAr))
            {
                if (!string.IsNullOrEmpty(txtMacLocationAr.Text))
                {
                    dt = DBFun.FetchData("SELECT * FROM MachineInfoView WHERE LocationAr = '" + txtMacLocationAr.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvLocationAr, true, General.Msg("Location (Ar) already exists,Please enter another Name", "الموقع (ع) موجود مسبقا ,من فضلك ادخل اسم آخر"));
                        e.IsValid = false;
                        return;
                    }
                }
            }

            if (source.Equals(cvLocationEn))
            {
                if (!string.IsNullOrEmpty(txtMacLocationEn.Text))
                {
                    dt = DBFun.FetchData("SELECT * FROM MachineInfoView WHERE LocationEn = '" + txtMacLocationEn.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvLocationEn, true, General.Msg("Location (En) already exists,Please enter another No.", "الموقع (En) موجود مسبقا ,من فضلك ادخل رقما آخر"));
                        e.IsValid = false;
                        return;
                    }
                }
            }
        }
        catch { e.IsValid = false; }
    }
Exemplo n.º 25
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void MachineNo_ServerValidate(Object source, ServerValidateEventArgs e)
    {
        string sqlUpdate = string.Empty;

        sqlUpdate = ViewState["CommandName"].ToString() == "Edit" ? " AND MacID != " + txtMachineID.Text : "";
        try
        {
            if (source.Equals(cvMachineNo))
            {
                if (!string.IsNullOrEmpty(txtMachineNo.Text))
                {
                    dt = DBFun.FetchData("SELECT * FROM MachineInfoView WHERE MachineNo = '" + txtMachineNo.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvMachineNo, true, General.Msg("Machine No. already exists,Please enter another No.", "رقم المكينة موجود مسبقا ,من فضلك ادخل رقما آخر"));
                        e.IsValid = false;
                        return;
                    }
                }
            }

            if (source.Equals(cvMacSerialNo))
            {
                if (!string.IsNullOrEmpty(txtMacSerialNo.Text))
                {
                    dt = DBFun.FetchData("SELECT * FROM MachineInfoView WHERE MachineSerialNo = '" + txtMacSerialNo.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvMacSerialNo, true, General.Msg("Machine Serial No. already exists,Please enter another No.", "رقم المكينة التسلسلي موجود مسبقا ,من فضلك ادخل رقما آخر"));
                        e.IsValid = false;
                        return;
                    }
                }
            }
        }
        catch { e.IsValid = false; }
    }
Exemplo n.º 26
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void IPAddress_ServerValidate(Object source, ServerValidateEventArgs e)
    {
        string sqlUpdate = string.Empty;

        sqlUpdate = ViewState["CommandName"].ToString() == "Edit" ? " AND MacID != " + txtMachineID.Text : "";

        try
        {
            if (source.Equals(cvIPAddress))
            {
                if (!string.IsNullOrEmpty(txtIPAddress.Text))
                {
                    dt = DBFun.FetchData("SELECT * FROM MachineInfoView WHERE IPAddress = '" + txtIPAddress.Text + "' " + sqlUpdate);
                    if (!DBFun.IsNullOrEmpty(dt))
                    {
                        MessageFun.ValidMsg(this, ref cvIPAddress, true, General.Msg("IP Address already exists,Please enter different IP", "رقم IP موجود مسبقا ,من فضلك ادخل رقما آخر"));
                        e.IsValid = false;
                        return;
                    }
                }
            }
        }
        catch { e.IsValid = false; }
    }
Exemplo n.º 27
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void SearchBy_ServerValidate(Object source, ServerValidateEventArgs e)
    {
        try
        {
            if (source.Equals(cvSearchBy))
            {
                if (string.IsNullOrEmpty(txtSearchBy.Text))
                {
                    General.ValidMsg(this, ref cvSearchBy, false, "You must enter a value in the search box", "يجب إدخال قيمة في مربع البحث");
                    e.IsValid = false;
                    return;
                }
                else
                {
                    ViewState["VisIdentityNo"] = "";
                    DataTable VDT = DBFun.FetchData(" SELECT VisIdentityNo FROM VisitorsCard WHERE " + ddlSearchBy.SelectedValue + " = '" + txtSearchBy.Text.Trim() + "' ");
                    if (!DBFun.IsNullOrEmpty(VDT))
                    {
                        string VisIdentityNo = VDT.Rows[0]["VisIdentityNo"].ToString();
                        bool   isBlakList    = FindBlackList(VisIdentityNo);
                        if (isBlakList)
                        {
                            General.ValidMsg(this, ref cvSearchBy, true, "Visitor Identity No. entered is included in the blacklist and can not be issued a card", "رقم هوية الزائر المدخل موجود في القائمة السوداء لا يمكن اصدار بطاقة له");
                            e.IsValid             = false;
                            txtVisIdentityNo.Text = "";
                            ButtonAction("00", true);
                            return;
                        }

                        ViewState["VisIdentityNo"] = VDT.Rows[0]["VisIdentityNo"].ToString();
                    }
                }
            }
        }
        catch (Exception ex)  { e.IsValid = false; }
    }
Exemplo n.º 28
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void PopulateUI(string pID)
    {
        try
        {
            dt = DBFun.FetchData("SELECT * FROM AppUsers WHERE UsrLoginID = '" + pID + "'");
            if (DBFun.IsNullOrEmpty(dt))
            {
                return;
            }

            txtUsrLoginID.Text = dt.Rows[0]["UsrLoginID"].ToString();
            if (txtUsrLoginID.Text == "admin")
            {
                EnableItem(false);
            }
            else
            {
                EnableItem(true);
            }

            txtUsrPassword.Attributes["value"] = CryptorEngine.Decrypt(dt.Rows[0]["UsrPassword"].ToString(), true);
            txtUsrFullName.Text = dt.Rows[0]["UsrFullName"].ToString();
            txtUsrEmailID.Text  = dt.Rows[0]["UsrEmailID"].ToString();

            //txtUsrEmpID.Text = dt.Rows[0]["UsrEmpID"].ToString();

            calUsrStartDate.setDBDate(dt.Rows[0]["UsrStartDate"], dt.Rows[0]["UsrStartDateType"].ToString());
            calUsrExpiryDate.setDBDate(dt.Rows[0]["UsrExpiryDate"], dt.Rows[0]["UsrExpiryDateType"].ToString());

            ddlUsrStatus.SelectedIndex = ddlUsrStatus.Items.IndexOf(ddlUsrStatus.Items.FindByValue(Convert.ToInt16(dt.Rows[0]["UsrStatus"]).ToString()));
            txtUsrDescription.Text     = dt.Rows[0]["UsrDescription"].ToString();

            PermCtl.PopulatePermissions(dt.Rows[0]["UsrPermission"].ToString(), txtUsrLoginID.Text);
        }
        catch (Exception e1) { }
    }
Exemplo n.º 29
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void PopulateUI()
    {
        try
        {
            dt = DBFun.FetchData(MainQuery);
            if (DBFun.IsNullOrEmpty(dt))
            {
                return;
            }

            txtAppCompany.Text  = dt.Rows[0]["AppCompany"].ToString();
            txtAppDisplay.Text  = dt.Rows[0]["AppDisplay"].ToString();
            txtAppAddress1.Text = dt.Rows[0]["AppAddress1"].ToString();
            txtAppAddress2.Text = dt.Rows[0]["AppAddress2"].ToString();
            txtAppCity.Text     = dt.Rows[0]["AppCity"].ToString();
            txtAppCountry.Text  = dt.Rows[0]["AppCountry"].ToString();
            txtAppPOBox.Text    = dt.Rows[0]["AppPOBox"].ToString();
            txtAppTelNo1.Text   = dt.Rows[0]["AppTelNo1"].ToString();
            txtAppTelNo2.Text   = dt.Rows[0]["AppTelNo2"].ToString();
            txtAppFax.Text      = dt.Rows[0]["AppFax"].ToString();
            txtAppUrl.Text      = dt.Rows[0]["AppUrl"].ToString();
            txtAppEmail.Text    = dt.Rows[0]["AppEmail"].ToString();

            ddlAppCalendar.SelectedIndex = ddlAppCalendar.Items.IndexOf(ddlAppCalendar.Items.FindByValue(dt.Rows[0]["AppCalendar"].ToString()));

            if ((dt.Rows[0]["AppLogo"] == DBNull.Value) || (dt.Rows[0]["AppLogoImageLength"].ToString() == "0"))
            {
                imgLogo.ClearImage();
            }
            else
            {
                imgLogo.setImage("Logo");
            }
        }
        catch (Exception e1) { }
    }
Exemplo n.º 30
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void PopulateData(string pID)
    {
        try
        {
            dt = DBFun.FetchData(MainQuery + " AND EvrID = " + pID + "");
            if (DBFun.IsNullOrEmpty(dt))
            {
                return;
            }
            txtEvrID.Text            = dt.Rows[0]["EvrID"].ToString();
            txtEmpID.Text            = dt.Rows[0]["EmpID"].ToString();
            ddlVacType.SelectedIndex = ddlVacType.Items.IndexOf(ddlVacType.Items.FindByValue(Convert.ToInt16(dt.Rows[0]["VtpID"]).ToString()));

            calStartDate.setDBDate(dt.Rows[0]["EvrStartDate"], "S");
            calEndDate.setDBDate(dt.Rows[0]["EvrEndDate"], "S");

            txtPhoneNo.Text   = dt.Rows[0]["EvrPhone"].ToString();
            txtAvailable.Text = dt.Rows[0]["EvrAvailability"].ToString();
            txtEvrDesc.Text   = dt.Rows[0]["EvrDescription"].ToString();

            ButtonAction(true, "11100");
        }
        catch (Exception Ex) { }
    }