Exemplo n.º 1
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void ClearUI()
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
        int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = 'Employee' AND EmpID='" + txtEmpNationalID.Text + "'");

        txtEmpIdentity.Text   = "";
        txtEmpNameAr.Text     = "";
        txtEmpNameEn.Text     = "";
        txtJobTitleAr.Text    = "";
        txtJobTitleEn.Text    = "";
        txtEmpNationalID.Text = "";
        txtMobile.Text        = "";
        txtEmail.Text         = "";

        CalBirthDate.ClearDate();
        CalHireDate.ClearDate();

        ddlNatID.SelectedIndex      = -1;
        ddlBloodGroup.SelectedIndex = -1;
        ddlCompID.SelectedIndex     = -1;
        ddlSecID.SelectedIndex      = -1;
        rdlGender.SelectedIndex     = 0;

        EmpImage.ClearImage();
    }
Exemplo n.º 2
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void ClearUI()
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
        int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = 'Visitors' AND EmpID='" + txtVisIdentityNo.Text + "'");

        txtVisCardID.Text     = "";
        txtVisIdentityNo.Text = "";
        txtVisNameAr.Text     = "";
        txtVisNameEn.Text     = "";
        txtVisMobileNo.Text   = "";
        calStartDate.ClearDate();
        calExpiryDate.ClearDate();

        for (int i = 1; i < 10; i++)
        {
            chkbRegion.Items.FindByValue("Region" + i.ToString()).Selected = false;
        }

        txtDescription.Text    = "";
        ddlTmpID.SelectedIndex = -1;
        VisImage.ClearImage();
        divCardCount.Visible     = false;
        txtVisIdentityNo.Enabled = false;
    }
Exemplo n.º 3
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void GetImage(out byte[] pImage, out string pImageContentType, out int pImageLength)
    {
        pImage            = new Byte[0];
        pImageContentType = "";
        pImageLength      = 0;

        string fileName  = FindID() + ".jpeg";
        string path      = Server.MapPath(FindTempImagePath()) + fileName;
        bool   available = System.IO.File.Exists(path);

        try
        {
            dt = DBFun.FetchData("SELECT * FROM TempImage WHERE Type = '" + Type + "' AND EmpID='" + FindID() + "'");
            if (DBFun.IsNullOrEmpty(dt))
            {
                if (available)
                {
                    try
                    {
                        int    len                   = System.IO.Path.GetFullPath(path).Length;
                        byte[] imageData             = new Byte[100000];
                        System.IO.FileStream newFile = new System.IO.FileStream(path, System.IO.FileMode.Open);
                        newFile.Read(imageData, 0, imageData.Length);
                        pImage            = (byte[])imageData;
                        pImageContentType = "image/pjpeg";
                        pImageLength      = imageData.Length;
                    }
                    catch (Exception e1) { System.IO.File.Delete(path); }
                }
                else
                {
                    DataTable imgdt = DBFun.FetchData(FindQuery());
                    if (!DBFun.IsNullOrEmpty(imgdt))
                    {
                        if (!IsEncryption)
                        {
                            pImage = (Byte[])imgdt.Rows[0]["Image"];
                        }
                        else
                        {
                            pImage = CryptoImage.DecryptBytes((Byte[])imgdt.Rows[0]["Image"]);
                        }
                        pImageContentType = imgdt.Rows[0]["ImageType"].ToString();
                        pImageLength      = Convert.ToInt32(imgdt.Rows[0]["ImageLen"]);
                    }
                }
            }
            else
            {
                pImage            = (Byte[])dt.Rows[0]["photo"];
                pImageContentType = dt.Rows[0]["PhotoType"].ToString();
                pImageLength      = Convert.ToInt32(dt.Rows[0]["PhotoLength"]);
            }

            int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = '" + Type + "' AND EmpID='" + FindID() + "'");
        }
        catch (Exception e2)
        {
            int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = '" + Type + "' AND EmpID='" + FindID() + "'");
        }
    }
Exemplo n.º 4
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void ClearImage()
    {
        int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = '" + Type + "' AND EmpID='" + FindID() + "'");

        imgPhoto.ImageUrl = EmptyImage();
    }