示例#1
0
 private void SellerForm_Load(object sender, EventArgs e)
 {
     populate();
     EID.Hide();
     label3.Hide();
     label9.Hide();
     label10.Hide();
 }
示例#2
0
 public void cleartext()
 {
     EID.Clear();
     EName.Clear();
     EAge.Clear();
     EPhone.Clear();
     ECNIC.Clear();
     EPass.Clear();
 }
        /// <summary>
        /// The ToString implementation.
        /// </summary>
        /// <param name="format">The format specifier to use, e.g. <b>Console.WriteLine(elem.ToString("fs"));</b></param>
        /// <param name="provider">Allow clients to format output for their own types 
        /// using [ICustomFormatter](https://msdn.microsoft.com/en-us/library/system.icustomformatter.aspx).</param>
        /// <returns>The formatted string.</returns>
        /// <exception cref="FormatException">thrown if an invalid format string is specified.</exception>
        /// \par Format specifiers:
        /// \arg \c LV Long version (verbose).
        /// \arg \c G Location, the depot-relative path of the element (default when not using a format specifier).
        /// \arg \c F \e True if the element is a folder, \e False otherwise.
        /// \arg \c E \e True if the executable bit is set, \e False if cleared. UNIX/Linux systems only.
        /// \arg \c I Element ID.
        /// \arg \c T The element's type: \e dir, \e text, \e binary, \e ptext, \e elink, or \e slink.
        /// \arg \c FS File size in bytes.
        /// \arg \c MT Element's modification time.
        /// \arg \c H "Hierarchy type" of the element, one of two possible values: \e parallel or \e serial.
        /// \arg \c V Virtual stream\\version number format, e.g. \c 5\12
        /// \arg \c R Real stream\\version number format.
        /// \arg \c N The named stream-name\\version-number designation, e.g. \c MARS_STAGE\7 or \c MARS_STAGE_barnyrd\24
        /// \arg \c L Stream where the element is located when it has (\e underlap)(\e member) or (\e overlap)(\e member) status.
        /// \arg \c TB Name of first time-based stream found when <tt>stat -s \<stream\> -o -B -fox</tt> is used to retrieve elements with (\e overlap) and/or (\e underlap) status.
        /// \arg \c S The version's status, e.g. (\e kept)(\e member)
        public string ToString(string format, IFormatProvider provider)
        {
            if (provider != null)
            {
                ICustomFormatter fmt = provider.GetFormat(this.GetType()) as ICustomFormatter;
                if (fmt != null)
                    return fmt.Format(format, this, provider);
            }

            if (String.IsNullOrEmpty(format))
                format = "G";

            switch (format.ToUpperInvariant())
            {
                case "LV": // long version (verbose)
                {
                    if (_modTime != null)
                        return $"{Location}, {Status}{Environment.NewLine}" +
                                $"\tEID: {EID} {{{ElementType}}}, Size: {Size}, ModTime: {ModTime},{Environment.NewLine}" +
                                $"\t{NamedVersion}, Virtual: {VirStreamNumber}\\{VirVersionNumber}, Real: {RealStreamNumber}\\{RealVersionNumber}";
                    else
                        return $"{Location}, {Status}{Environment.NewLine}" +
                                $"\tEID: {EID} {{{ElementType}}}{Environment.NewLine}" +
                                $"\t{NamedVersion}, Virtual: {VirStreamNumber}\\{VirVersionNumber}, Real: {RealStreamNumber}\\{RealVersionNumber}";
                }
                case "G":  // location, the depot-relative path of the element (default when not using a format specifier)
                    return Location;
                case "F":  // True if the element is a folder, False otherwise
                    return Folder.ToString();
                case "E":  // UNIX/Linux systems only: True if the executable bit is set, False if cleared
                    return Executable.ToString();
                case "I":  // element ID
                    return EID.ToString();
                case "T":  // element's type: dir, text, binary, ptext, elink, or slink
                    return ElementType.ToString();
                case "FS": // file size in bytes
                    return (Size == null) ? String.Empty : Size.ToString();
                case "MT": // element's modification time
                    return ModTime.ToString();
                case "H": // hierarchy type: parallel or serial
                    return HierType;
                case "V": // virtual stream\\version number designation, e.g. 5\12
                    return $"{VirStreamNumber}\\{VirVersionNumber}";
                case "R": // real stream\\version number designation, e.g. 5\12
                    return $"{RealStreamNumber}\\{RealVersionNumber}";
                case "N": // named stream\version number format, e.g. MARS_STAGE\7 or MARS_STAGE_barnyrd\24
                    return NamedVersion;
                case "L": // stream where element is located when it has (\e underlap)(\e member) or (\e overlap)(\e member) status
                    return LapStream;
                case "TB": // first time-based stream found when 'stat -s stream -o -B -fox' is used to retrieve elements with (overlap) and/or (underlap) status
                    return TimeBasedStream;
                case "S": // version's status, e.g. (kept)(member)
                    return Status;
                default:
                    throw new FormatException($"The {format} format string is not supported.");
            }
        }
示例#4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (EID.Text == "" || EName.Text == "" || CitizenNo.Text == "" || MStatus.Text == "" || EFName.Text == "" || EMName.Text == "" || EPAdd.Text == "" || EReligion.Text == "" || EPost.Text == "" || EQualification.Text == "")
            {
                MessageBox.Show("Please Fill the Record Properly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (string.IsNullOrEmpty(EID.Text))
                {
                    MessageBox.Show("Please enter Employee ID");
                    EID.Focus();
                    return;
                }
                else
                {
                    try
                    {
                        EPhoto.Image.Save(Application.StartupPath + "\\images\\" + EID.Text + ".jpg", ImageFormat.Jpeg);

                        SqlConnection conn = new SqlConnection(str);
                        SqlCommand    cmd  = new SqlCommand("insert into tbl_employee ([EID],[name],[citizen],[gender],[Mstatus],[DOB],[Fname],[Mname],[Padd],[Tadd],[contact],[religion],[dept],[dateofjoin],[exp],[email],[post],[acc],[salary],[qualification],[comment],[photo]) values('" + EID.Text + "','" + EName.Text + "','" + CitizenNo.Text + "','" + checkgender() + "','" + MStatus.Text + "','" + DOB.Text + "','" + EFName.Text + "','" + EMName.Text + "','" + EPAdd.Text + "','" + ETAdd.Text + "','" + EContact.Text + "','" + EReligion.Text + "','" + EDept.Text + "','" + Dateofjoining.Text + "','" + EExperience.Text + "','" + EEmail.Text + "','" + EPost.Text + "','" + EBankAcc.Text + "','" + EBSalary.Text + "','" + EQualification.Text + "','" + EComment.Text + "','" + EID.Text + "')", conn);

                        try
                        {
                            conn.Open();
                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Employee record inserted Succesfully", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            reset();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Problem is:" + ex);
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Please choose Employee image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
        protected void Layout(object sender, EventArgs e)
        {
            using (GridViewRow _row = (GridViewRow)((ImageButton)sender).Parent.Parent)
            {
                EID             = Convert.ToInt32(GVListHopdong.DataKeys[_row.RowIndex].Value);
                ViewState["ID"] = EID.ToString();
                //lblMess.Text = "";
                LinkButton _lblTenKH = (LinkButton)GVListHopdong.Rows[_row.RowIndex].FindControl("btnEdit");
                if (_lblTenKH != null)
                {
                    lbl_TenKH.Text = "Tên khách hàng: " + _lblTenKH.Text.Trim();
                }
                else
                {
                    lbl_TenKH.Text = "";
                }
                Label _lblSHD = (Label)GVListHopdong.Rows[_row.RowIndex].FindControl("lblSohopdong");
                if (!String.IsNullOrEmpty(_lblSHD.Text))
                {
                    lbl_SoHD.Text = "Số hợp đồng: " + _lblSHD.Text;
                }
                else
                {
                    lbl_SoHD.Text = "";
                }

                HopdongDAL daldh = new HopdongDAL();
                SotienHD = daldh.GetOneFromT_HopdongByID(EID).Sotien;

                if (SotienHD != 0)
                {
                    lblTongtien.Text = " Tổng tiền: " + String.Format("{0:00,0}", Convert.ToDecimal(SotienHD));
                }
                else
                {
                    lblTongtien.Text = " Tổng tiền: " + String.Format("{0:00,0}", "0");
                }
                lblMessError.Text = "";
                BindDataLichSuThanhToanPhatHanh();
                popup.Show();
            }
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            int      counter = 0;
            string   line, pp, In, EID, Month, Date1;
            int      EmployeeNumber, FingerID, lenght;
            DateTime CheckIn, LIn, LOut, CheckOut;

            //  bool exists = false;
            // Read the file and display it line by line.
            System.IO.StreamReader file =
                new System.IO.StreamReader(@"g:\test.txt");
            while ((line = file.ReadLine()) != null)
            {
                // lines = char.Parse(line);
                lenght = line.Length - 1;
                //for(int i=0;i<line.Length-1; i++ )
                //{
                In  = line[0].ToString() + line[1].ToString() + line[2].ToString() + line[3].ToString() + line[4].ToString() + line[5].ToString() + line[6].ToString() + line[7].ToString() + line[8].ToString() + line[9].ToString() + " " + line[19].ToString() + line[20].ToString() + ":" + line[21].ToString() + line[22].ToString() + ":" + line[23].ToString() + line[24].ToString();
                pp  = line[26].ToString() + line[27].ToString() + line[28].ToString() + line[29].ToString() + line[30].ToString();
                EID = line[14].ToString() + line[15].ToString() + line[16].ToString() + line[17].ToString() + line[18].ToString();
                int Empid = int.Parse(EID.ToString());
                Month   = line[5].ToString() + line[6].ToString();
                Date1   = line[0].ToString() + line[1].ToString() + line[2].ToString() + line[3].ToString() + line[4].ToString() + line[5].ToString() + line[6].ToString() + line[7].ToString() + line[8].ToString() + line[9].ToString();
                CheckIn = Convert.ToDateTime(In);
                bool exists = false;
                //using (SqlCommand cmd1 = new SqlCommand("select * from CheckIn where CheckIn = @CheckIn ", Con))
                //{
                //    Con.Open();
                //    cmd1.Parameters.AddWithValue("CheckIn", CheckIn);
                //    exists = (int)cmd1.ExecuteScalar() > 0;
                //}

                //if (exists == true)
                //{
                //    MessageBox.Show("لا يوجد سجل دوام.");
                //    Con.Close();
                //}
                //else
                //{

                try
                {
                    Con.Close();
                    using (SqlCommand cmd = new SqlCommand("select LocationName from [Location] where LocationID = (select LocationID from Employee where EmployeeID = @EmployeeID)", Con))
                    {
                        Con.Open();
                        cmd.Parameters.AddWithValue("EmployeeID", Empid);
                        cmd.ExecuteNonQuery();
                        LocationNa = (string)cmd.ExecuteScalar();
                        //     MessageBox.Show("Added Successfully !", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Con.Close();
                    }
                }
                catch (SqlException ex)
                {
                    MessageBox.Show("Some Error Occured !" + ex.Message);
                }
                finally
                {
                    Con.Close();
                }
                if (line[lenght - 5].ToString() == "I")
                {
                    CheckIn        = Convert.ToDateTime(In);
                    EmployeeNumber = int.Parse(EID.ToString());
                    FingerID       = int.Parse(pp.ToString());
                    Con.Open();
                    using (SqlCommand cmd1 = new SqlCommand("select count(*) from [CheckIn] where CheckIn = @CheckIn", Con))
                    {
                        cmd1.Parameters.AddWithValue("CheckIn", CheckIn);
                        exists = (int)cmd1.ExecuteScalar() > 0;
                    }

                    if (exists == false)
                    {
                        try
                        {
                            //Con.Open();
                            using (SqlCommand cmd = new SqlCommand("INSERT INTO [CheckIn] values ( @FingerPrintID, @EmployeeID, @CheckIn, @Month, @Date1, @LocationNa)", Con))
                            {
                                cmd.Parameters.AddWithValue("FingerPrintID", FingerID);
                                cmd.Parameters.AddWithValue("EmployeeID", EmployeeNumber);
                                cmd.Parameters.AddWithValue("CheckIn", CheckIn);
                                cmd.Parameters.AddWithValue("Month", Month);
                                cmd.Parameters.AddWithValue("Date1", Date1);
                                cmd.Parameters.AddWithValue("LocationNa", LocationNa);
                                cmd.ExecuteNonQuery();
                                //      MessageBox.Show("Added Successfully !", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Con.Close();
                            }
                        }
                        catch (SqlException ex)
                        {
                            MessageBox.Show("Some Error Occured !" + ex.Message + EmployeeNumber);
                        }
                        finally
                        {
                            Con.Close();
                        }
                    }
                    Con.Close();
                }
                if (line[lenght - 5].ToString() == "i")
                {
                    LIn            = Convert.ToDateTime(In);
                    EmployeeNumber = int.Parse(EID.ToString());
                    FingerID       = int.Parse(pp.ToString());
                    Con.Close();
                    Con.Open();
                    using (SqlCommand cmd1 = new SqlCommand("select count(*) from [LIn] where LIn = @LIn", Con))
                    {
                        cmd1.Parameters.AddWithValue("LIn", LIn);
                        exists = (int)cmd1.ExecuteScalar() > 0;
                    }

                    if (exists == false)
                    {
                        try
                        {
                            Con.Close();
                            Con.Open();
                            using (SqlCommand cmd = new SqlCommand("INSERT INTO [LeaveIn] values ( @FingerPrintID, @EmployeeID, @LIn, @Date1)", Con))
                            {
                                cmd.Parameters.AddWithValue("FingerPrintID", FingerID);
                                cmd.Parameters.AddWithValue("EmployeeID", EmployeeNumber);
                                cmd.Parameters.AddWithValue("LIn", LIn);
                                cmd.Parameters.AddWithValue("Date1", Date1);
                                cmd.ExecuteNonQuery();

                                //    MessageBox.Show("Added Successfully !", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Con.Close();
                            }
                        }
                        catch (SqlException ex)
                        {
                            MessageBox.Show("Some Error Occured !" + ex.Message);
                        }
                        finally
                        {
                            Con.Close();
                        }
                    }
                    Con.Close();
                }
                if (line[lenght - 5].ToString() == "o")
                {
                    LOut           = Convert.ToDateTime(In);
                    EmployeeNumber = int.Parse(EID.ToString());
                    FingerID       = int.Parse(pp.ToString());
                    Con.Close();
                    Con.Open();
                    using (SqlCommand cmd1 = new SqlCommand("select count(*) from [LOut] where LOut = @LOut", Con))
                    {
                        cmd1.Parameters.AddWithValue("LOut", LOut);
                        exists = (int)cmd1.ExecuteScalar() > 0;
                    }

                    if (exists == false)
                    {
                        try
                        {
                            Con.Close();
                            Con.Open();
                            using (SqlCommand cmd = new SqlCommand("INSERT INTO [LeaveOut] values ( @FingerPrintID, @EmployeeID, @LOut, @Date1)", Con))
                            {
                                cmd.Parameters.AddWithValue("FingerPrintID", FingerID);
                                cmd.Parameters.AddWithValue("EmployeeID", EmployeeNumber);
                                cmd.Parameters.AddWithValue("LOut", LOut);
                                cmd.Parameters.AddWithValue("Date1", Date1);
                                cmd.ExecuteNonQuery();
                                // MessageBox.Show("Added Successfully !", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Con.Close();
                            }
                        }
                        catch (SqlException ex)
                        {
                            MessageBox.Show("Some Error Occured !" + ex.Message);
                        }
                        finally
                        {
                            Con.Close();
                        }
                    }
                    Con.Close();
                }
                if (line[lenght - 5].ToString() == "O")
                {
                    CheckOut       = Convert.ToDateTime(In);
                    EmployeeNumber = int.Parse(EID.ToString());
                    FingerID       = int.Parse(pp.ToString());
                    CheckIn        = new DateTime();
                    LIn            = new DateTime();
                    LOut           = new DateTime();
                    Con.Close();
                    Con.Open();
                    using (SqlCommand cmd1 = new SqlCommand("select count(*) from [CheckOut] where CheckOut = @CheckOut", Con))
                    {
                        cmd1.Parameters.AddWithValue("CheckOut", CheckOut);
                        exists = (int)cmd1.ExecuteScalar() > 0;
                    }

                    if (exists == false)
                    {
                        try
                        {
                            //  using (SqlCommand cmd = new SqlCommand("INSERT INTO [Attendance] values (@AttendanceId, @FingerPrintID, @EmployeeID, @CheckIn, @CheckOut, @LIn, @LOut)", Con))

                            // Con.Open();
                            using (SqlCommand cmd = new SqlCommand("INSERT INTO [CheckOut] values (@FingerPrintID, @EmployeeID, @CheckOut, @Month, @Date1, @LocationNa)", Con))
                            {
                                cmd.Parameters.AddWithValue("FingerPrintID", FingerID);
                                cmd.Parameters.AddWithValue("EmployeeID", EmployeeNumber);
                                cmd.Parameters.AddWithValue("CheckOut", CheckOut);
                                cmd.Parameters.AddWithValue("Month", Month);
                                cmd.Parameters.AddWithValue("Date1", Date1);
                                cmd.Parameters.AddWithValue("LocationNa", LocationNa);

                                cmd.ExecuteNonQuery();
                                //   MessageBox.Show("Added Successfully !", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Con.Close();
                            }
                        }
                        catch (SqlException ex)
                        {
                            MessageBox.Show("Some Error Occured !" + ex.Message + EmployeeNumber);
                        }
                        finally
                        {
                            Con.Close();
                        }
                        Con.Close();
                    }
                }


                //System.Console.WriteLine(line);
                //MessageBox.Show(line);
                counter++;
            }


            file.Close();
            System.Console.WriteLine("There were {0} lines.", counter);
            // Suspend the screen.
            System.Console.ReadLine();
        }
示例#7
0
 public void Push(EID ID)
 {
     WriteBuffer[WriteCount].mID   = ID;
     WriteBuffer[WriteCount].mTime = Stopwatch.GetTimestamp();
     ++WriteCount;
 }
示例#8
0
 public override void Validar()
 {
     this.ValidarBloqueio();
     EID.ValidarEID();
 }