コード例 #1
0
ファイル: Cash Transaction.cs プロジェクト: glcc4it/inventory
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtAccountName.Text == "")
            {
                MessageBox.Show("Please select account", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAccountName.Focus();
                return;
            }
            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();

                string cb = "insert into tbl_transaction([Date],[AccountID],accountname,mobileno,[PaymentMode],[DiscountType],[DiscountAmount],[CurrencyType],[PaymentModeDetails],[Oldbalance],[Amount],[Notes])" +
                            "VALUES ('" + dtpTranactionDate.Text + "' ,'" + txtAccountID.Text + "' ,'" + txtAccountName.Text + "','" + txtContactNo.Text + "', '" + cmbPaymentMode.Text + "', '" + comboDiscounttype.Text + "', '" + textBox1.Text + "', '" + comboCurrencyType.Text + "', '" + txtPaymentModeDetails.Text + "', '" + lblBalance.Text + "', '" + txtTotalAmountafterdis.Text + "', '" + txtNotes.Text + "')";

                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteReader();
                ModCommonClasses.con.Close();
                MessageBox.Show("Successfully saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ModFunc.LogFunc(lblUser.Text, "Add the Transaction For Account name  '" + txtAccountName.Text + "' with Amount '" + txtTotalAmountafterdis.Text + "'");
                DisplayData();
                ClearData();

                this.ActiveControl = txtAccountName;
                txtAccountName.Focus();
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_Expense_Type.Text != "")
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                ModCommonClasses.cmd = new SqlCommand("insert into tbl_ExpenseMaster(ExpenseType,Status,Notes) values(@ExpenseType,@Status,@Notes)", ModCommonClasses.con);

                ModCommonClasses.cmd.Parameters.AddWithValue("@ExpenseType", txt_Expense_Type.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Status", combo_Status.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Notes", txt_des.Text);


                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();



                this.ActiveControl = txt_Expense_Type;
                txt_Expense_Type.Focus();

                MessageBox.Show("Record Inserted Successfully");
                ModFunc.LogFunc(lblUser.Text, "Save the ExpenseName '" + txt_Expense_Type.Text + "' Having ExpensesID '" + txtID.Text + "'");
                DisplayData();
                ClearData();
            }
            else
            {
                MessageBox.Show("Please Provide Details!");
            }
        }
コード例 #3
0
ファイル: Logs.cs プロジェクト: glcc4it/inventory
        public void DeleteRecord()
        {
            try
            {
                int RowsAffected = 0;
                ModCommonClasses.con.Open();
                string ct = "delete from Logs";
                ModCommonClasses.cmd            = new SqlCommand(ct);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                RowsAffected = ModCommonClasses.cmd.ExecuteNonQuery();
                if (RowsAffected > 0)
                {
                    ModCommonClasses.con = new SqlConnection(ModCS.cs);
                    ModCommonClasses.con.Open();
                    string st = "Deleted the All Logs Till Date '" + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt") + "'";
                    ModFunc.LogFunc(lblUser.Text, st);
                    MessageBox.Show("Successfully Deleted", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    GetData();
                }
                else
                {
                    MessageBox.Show("No Record Found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                ModCommonClasses.con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_godown_name.Text != "")
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                ModCommonClasses.cmd = new SqlCommand("insert into tbl_godown(godownname,date,narration) values(@godownname,@date,@narration)", ModCommonClasses.con);

                ModCommonClasses.cmd.Parameters.AddWithValue("@godownname", txt_godown_name.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@date", dateTimePicker1.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@narration", txt_des.Text);


                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();



                this.ActiveControl = txt_godown_name;
                txt_godown_name.Focus();

                MessageBox.Show("Record Inserted Successfully");
                ModFunc.LogFunc(lblUser.Text, "Save the Godowname '" + txt_godown_name.Text + "' Having Godown ID '" + txtID.Text + "'");
                DisplayData();
                ClearData();
            }
            else
            {
                MessageBox.Show("Please Provide Details!");
            }
        }
コード例 #5
0
ファイル: Dashboard.cs プロジェクト: glcc4it/inventory
        private void linkLabel31_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                openFileDialog1.Filter      = ("DB Backup File|*.bak;");
                openFileDialog1.FilterIndex = 4;
                //Clear the file name
                openFileDialog1.FileName = "";

                if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Cursor         = Cursors.WaitCursor;
                    timer2.Enabled = true;
                    SqlConnection.ClearAllPools();
                    ModCommonClasses.con = new SqlConnection(ModCS.cs);
                    ModCommonClasses.con.Open();
                    string cb = "USE Master ALTER DATABASE Inventory_DB SET Single_User WITH Rollback Immediate Restore database Inventory_DB FROM disk='" + openFileDialog1.FileName + "' WITH REPLACE ALTER DATABASE Inventory_DB SET Multi_User ";
                    ModCommonClasses.cmd            = new SqlCommand(cb);
                    ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                    ModCommonClasses.cmd.ExecuteReader();
                    ModCommonClasses.con.Close();
                    string st = "Sucessfully performed the restore";
                    ModFunc.LogFunc(lblUser.Text, st);
                    MessageBox.Show("Successfully performed", "Database Restore", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_rack_name.Text == "")
            {
                MessageBox.Show("Please enter rack name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_rack_name.Focus();
                return;
            }


            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select rackname from tbl_rackmaster where rackname='" + txt_rack_name.Text + "'";

                ModCommonClasses.cmd            = new SqlCommand(ct);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();

                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("Rack Name Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_rack_name.Text = "";
                    txt_rack_name.Focus();


                    if (ModCommonClasses.rdr != null)
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }

                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();

                string cb = "insert into tbl_rackmaster(rackname,godown,narration) VALUES ('" + txt_rack_name.Text + "' ,'" + combo_godown.Text + "' , '" + txt_des.Text + "')";

                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteReader();
                ModCommonClasses.con.Close();
                MessageBox.Show("Successfully saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ModFunc.LogFunc(lblUser.Text, "Add the Rackname '" + txt_rack_name.Text + "' Having Rack ID '" + txtID.Text + "'");
                DisplayData();
                ClearData();

                this.ActiveControl = txt_rack_name;
                txt_rack_name.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
ファイル: Categorymaster.cs プロジェクト: glcc4it/inventory
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_cat_name.Text == "")
            {
                MessageBox.Show("Please Enter Category Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_cat_name.Focus();
                return;
            }


            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select Categoryname from tbl_category where Categoryname='" + txt_cat_name.Text + "'";

                ModCommonClasses.cmd            = new SqlCommand(ct);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();

                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("Category Name Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_cat_name.Text = "";
                    txt_cat_name.Focus();


                    if (ModCommonClasses.rdr != null)
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }

                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();

                string cb = "insert into tbl_category(Categoryname,Color,Status) VALUES ('" + txt_cat_name.Text + "' ,'" + cmbboxClr.Text + "' , '" + combo_status.Text + "')";

                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteReader();
                ModCommonClasses.con.Close();
                MessageBox.Show("Successfully Saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ModFunc.LogFunc(lblUser.Text, "Add the Category '" + txt_cat_name.Text + "' Having Category ID '" + txtID.Text + "'");
                this.ActiveControl = txt_cat_name;
                txt_cat_name.Focus();
                DisplayData();
                ClearData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_unit.Text == "")
            {
                MessageBox.Show("Please Enter Unit Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_unit.Focus();
                return;
            }


            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select Unit_type from tbl_unitmaster where Unit_type='" + txt_unit.Text + "'";

                ModCommonClasses.cmd            = new SqlCommand(ct);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();

                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("Unit Name Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_unit.Text = "";
                    txt_unit.Focus();


                    if (ModCommonClasses.rdr != null)
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }

                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();

                string cb = "insert into tbl_unitmaster(Date,Unit_type) VALUES ('" + dateTimePicker1.Text + "' , '" + txt_unit.Text + "')";

                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteReader();
                ModCommonClasses.con.Close();
                MessageBox.Show("Successfully saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ModFunc.LogFunc(lblUser.Text, "Add the Unitname '" + txt_unit.Text + "' Having Unit ID '" + txtID.Text + "'");
                this.ActiveControl = txt_unit;
                txt_unit.Focus();
                DisplayData();
                ClearData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #9
0
ファイル: Dashboard.cs プロジェクト: glcc4it/inventory
        public void LogOut()
        {
            string st = "Successfully logged out";

            ModFunc.LogFunc(lblUser.Text, st);
            this.Hide();
            frmLogin ss = new frmLogin();

            ss.Show();
        }
コード例 #10
0
ファイル: Salesmanmaster.cs プロジェクト: glcc4it/inventory
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txt_salesman_name.Text == "")
            {
                MessageBox.Show("Please Select Record in Gridview", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_salesman_name.Focus();
                return;
            }

            try
            {


                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "Update tbl_salesman set Date=@d1, Salesmanname=@d2, Address=@d3, City=@d4, Email=@d5, Mobile=@d6, CNIC=@d7, Narration=@d8 WHERE Salesmancode=@id1";
                ModCommonClasses.cmd = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;

                ModCommonClasses.cmd.Parameters.AddWithValue("@id1", txtID.Text);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", dateTimePicker1.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", txt_salesman_name.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txt_address.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d4", txt_city.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txt_email.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d6", txt_mob.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d7", txt_cnic_no.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d8", txt_des.Text);
               


               
                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();
                string st = "Updated the Salesman '" + txt_salesman_name.Text + "' info";

                MessageBox.Show("Successfully Updated", "Salesman Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ModFunc.LogFunc(lblUser.Text, "Updated the Salesman '" + txt_salesman_name.Text + "' Having Salesman Code '" + txtID.Text + "'");
                DisplayData();
                ClearData();


                this.ActiveControl = txt_salesman_name;
                txt_salesman_name.Focus();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #11
0
ファイル: UserrRegisterd.cs プロジェクト: glcc4it/inventory
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Please Select Record in Gridview", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmbUserType.Focus();
                return;
            }

            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "Update tbl_login set UserID=@d1,UserType=@d2,Name=@d3,Password=@d4,Address=@d5,Email=@d6,Mobile=@d7,JoiningDate=@d8 WHERE UserID=@d1";
                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;

                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txtUserID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", cmbUserType.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txtName.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d4", txtPassword.Text);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txtAddress.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d6", txtemail.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d7", txtmobile.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d8", DateTime.Now);



                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();
                string st = "Updated the User '" + txtName.Text + "' info";

                MessageBox.Show("Successfully Updated", "User Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ModFunc.LogFunc(lblUser.Text, "Updated the User '" + txtName.Text + "' Having UserID '" + txtUserID.Text + "'");
                DisplayData();
                ClearData();
                this.ActiveControl = cmbUserType;
                cmbUserType.Focus();
                autonumber();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #12
0
ファイル: Salesmanmaster.cs プロジェクト: glcc4it/inventory
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_salesman_name.Text != "")
            {

                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                ModCommonClasses.cmd = new SqlCommand("insert into tbl_salesman(Date,Salesmanname,Address,City,Email,Mobile,CNIC,Narration) values(@Date,@Salesmanname,@Address,@City,@Email,@Mobile,@CNIC,@Narration)", ModCommonClasses.con);

                ModCommonClasses.cmd.Parameters.AddWithValue("@Date", dateTimePicker1.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Salesmanname", txt_salesman_name.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Address", txt_address.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@City", txt_city.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Email", txt_email.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Mobile", txt_mob.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@CNIC", txt_cnic_no.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@Narration", txt_des.Text);


                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();







                MessageBox.Show("Record Inserted Successfully");

                this.ActiveControl = txt_salesman_name;
                txt_salesman_name.Focus();
                ModFunc.LogFunc(lblUser.Text, "Added the Salesman '" + txt_salesman_name.Text + "' Having Salesman Code '" + txtID.Text + "'");
                DisplayData();
                ClearData();

            }
            else
            {
                MessageBox.Show("Please Provide Details!");

                this.ActiveControl = txt_salesman_name;
                txt_salesman_name.Focus();
            }
        }
コード例 #13
0
ファイル: UserrRegisterd.cs プロジェクト: glcc4it/inventory
        private void DeleteRecord()
        {
            try
            {
                int RowsAffected = 0;
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cq = "delete from tbl_login where UserID=@id1";
                ModCommonClasses.cmd            = new SqlCommand(cq);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.Parameters.AddWithValue("@id1", (txtUserID.Text));
                RowsAffected = ModCommonClasses.cmd.ExecuteNonQuery();
                if (RowsAffected > 0)
                {
                    string st = "Deleted the User '" + txtUserID.Text + "'";

                    MessageBox.Show("Successfully Deleted", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DisplayData();

                    ClearData();


                    this.ActiveControl = cmbUserType;
                    cmbUserType.Focus();
                    ModFunc.LogFunc(lblUser.Text, "Delete the User '" + txtName.Text + "' Having UserID '" + txtUserID.Text + "'");
                    autonumber();
                }
                else
                {
                    MessageBox.Show("No Record Found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmbUserType.Focus();
                    return;
                }
                if (ModCommonClasses.con.State == ConnectionState.Open)
                {
                    ModCommonClasses.con.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #14
0
ファイル: Add Expense.cs プロジェクト: glcc4it/inventory
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Inventory_DBEntities db = new Inventory_DBEntities();

            decimal idd = decimal.Parse(txtExpenseNumber.Text);
            var     tb  = db.tbl_AddExpenses.Where(x => x.id == idd).FirstOrDefault();

            tb.Date = dateTimePicker1.Text;
            if (txtInvoiceno.Text != "")
            {
                decimal invoice = decimal.Parse(txtInvoiceno.Text);
                tb.InvoiceNumber = invoice;
            }
            tb.ExpenseType     = cmbExpenseType.Text;
            tb.ExpensesName    = txtExpenseName.Text;
            tb.CurrencyType    = cmbCurrencyType.Text;
            tb.TransactionType = cmbTransactionType.Text;
            if (txtAmount.Text != "")
            {
                decimal amount = decimal.Parse(txtAmount.Text);
                tb.Amount = amount;
            }
            tb.Notes          = txtNotes.Text;
            tb.PaymentMethods = cmbPaymentMethod.Text;
            if (txtTax.Text != "")
            {
                decimal tax = decimal.Parse(txtTax.Text);
                tb.TaxAmount = tax;
            }
            if (txtTotal.Text != "")
            {
                decimal total = decimal.Parse(txtTotal.Text);
                tb.TotalAmount = total;
            }

            db.SaveChanges();

            MessageBox.Show("Successfully Updated", "Expense", MessageBoxButtons.OK, MessageBoxIcon.Information);
            ModFunc.LogFunc(lblUser.Text, "Updated the Expense With  ID :  '" + txtExpenseNumber.Text + "");
            DisplayData();
            ClearData();
        }
コード例 #15
0
ファイル: Add Expense.cs プロジェクト: glcc4it/inventory
        private void DeleteRecord()
        {
            try
            {
                Inventory_DBEntities db = new Inventory_DBEntities();

                decimal idd = decimal.Parse(txtExpenseNumber.Text);
                var     tb  = db.tbl_AddExpenses.Where(x => x.id == idd).FirstOrDefault();
                db.tbl_AddExpenses.Remove(tb);
                db.SaveChanges();

                MessageBox.Show("Successfully Delete", "Expense", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ModFunc.LogFunc(lblUser.Text, "Delted the Expense With  ID :  '" + txtExpenseNumber.Text + "");
                DisplayData();
                ClearData();
            }
            catch (Exception ex)
            {
            }
        }
コード例 #16
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txt_rack_name.Text == "")
            {
                MessageBox.Show("Please Select Record in Gridview", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_rack_name.Focus();
                return;
            }

            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "Update tbl_rackmaster set rackname=@d1, godown=@d2, narration=@d3 WHERE Sno=@id1";
                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;

                ModCommonClasses.cmd.Parameters.AddWithValue("@id1", txtID.Text);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txt_rack_name.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", combo_godown.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txt_des.Text);



                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();
                string st = "Updated the Rackno '" + txt_rack_name.Text + "' info";

                MessageBox.Show("Successfully Updated", "Rack Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ModFunc.LogFunc(lblUser.Text, "Updated the Rackname '" + txt_rack_name.Text + "' Having Rack ID '" + txtID.Text + "'");
                DisplayData();
                ClearData();
                this.ActiveControl = txt_rack_name;
                txt_rack_name.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #17
0
ファイル: Cash Transaction.cs プロジェクト: glcc4it/inventory
        private void DeleteRecord()
        {
            try
            {
                int RowsAffected = 0;
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cq = "delete from tbl_transaction where t_id=@id1";
                ModCommonClasses.cmd            = new SqlCommand(cq);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.Parameters.AddWithValue("@id1", (txtTransactionNo.Text));
                RowsAffected = ModCommonClasses.cmd.ExecuteNonQuery();
                if (RowsAffected > 0)
                {
                    string st = "Deleted the TRansactgion '" + txtTransactionNo.Text + "'";

                    MessageBox.Show("Successfully Deleted", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DisplayData();

                    ClearData();


                    ModFunc.LogFunc(lblUser.Text, "Delete the TRansaction '" + txtTransactionNo.Text + "'");
                }
                else
                {
                    MessageBox.Show("No Record Found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (ModCommonClasses.con.State == ConnectionState.Open)
                {
                    ModCommonClasses.con.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #18
0
ファイル: Cash Transaction.cs プロジェクト: glcc4it/inventory
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "Update tbl_transaction " +
                            "SET " +
                            " [Date] = '" + dtpTranactionDate.Text + "' " +
                            " ,[AccountID] ='" + txtAccountID.Text + "' " +
                            " ,[AccountName] ='" + txtAccountName.Text + "' " +
                            " ,[MobileNo] = '" + txtContactNo.Text + "' " +
                            ",[PaymentMode] = '" + cmbPaymentMode.Text + "' " +
                            " ,[DiscountType] = '" + comboDiscounttype.Text + "' " +
                            " ,[DiscountAmount] = '" + textBox1.Text + "' " +
                            " ,[CurrencyType] ='" + comboCurrencyType.Text + "' " +
                            " ,[PaymentModeDetails] = '" + cmbPaymentMode.Text + "' " +
                            " ,[Oldbalance] = '" + lblBalance.Text + "' " +
                            " ,[Amount] = '" + txtTotalAmountafterdis.Text + "' " +
                            " ,[Notes] = '" + txtNotes.Text + "' WHERE T_ID='" + txtTransactionNo.Text + "'";
                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;

                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();
                string st = "Updated the Transaction with ID  '" + txtTransactionNo.Text + "' info";

                MessageBox.Show("Successfully Updated", "Rack Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ModFunc.LogFunc(lblUser.Text, "Updated the Transaction with ID  '" + txtTransactionNo.Text + "' info");
                DisplayData();
                ClearData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #19
0
ファイル: UserrRegisterd.cs プロジェクト: glcc4it/inventory
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Please Enter Username", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtName.Focus();
                return;
            }


            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select userid from tbl_login where UserID=@d1";
                ModCommonClasses.cmd = new SqlCommand(ct);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txtUserID.Text);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();
                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("User ID Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtUserID.Text = "";
                    txtUserID.Focus();
                    if (ModCommonClasses.rdr != null)
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }

                if (chkActive.Checked == true)
                {
                    st1 = "Yes";
                }
                else
                {
                    st1 = "No";
                }
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "insert into tbl_login(UserID, UserType, Name, Password, Address, Email, Mobile, JoiningDate, Active) VALUES (@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9)";
                ModCommonClasses.cmd = new SqlCommand(cb);
                ModFunc ep = new ModFunc();
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txtUserID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", cmbUserType.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txtName.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d4", ModFunc.Encrypt(txtPassword.Text.Trim()));

                ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txtAddress.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d6", txtemail.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d7", txtmobile.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d8", DateTime.Now);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d9", st1);
                ModCommonClasses.cmd.ExecuteReader();
                ModCommonClasses.con.Close();
                string st = "added the new user '" + txtUserID.Text + "'";

                MessageBox.Show("Successfully Registered", "User", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ModFunc.LogFunc(lblUser.Text, "Add New User '" + txtName.Text + "' Having UserID '" + txtUserID.Text + "'");
                autonumber();
                this.ActiveControl = cmbUserType;
                cmbUserType.Focus();
                DisplayData();
                ClearData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #20
0
ファイル: Saleproduct.cs プロジェクト: glcc4it/inventory
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select Invoiceno from tbl_salemaster where Invoiceno=@d1";
                ModCommonClasses.cmd = new SqlCommand(ct);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txt_invoice_no.Text);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();
                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("Invoice No. Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_invoice_no.Text = "";
                    txt_invoice_no.Focus();
                    if ((ModCommonClasses.rdr != null))
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }
                ModCommonClasses.con.Close();


                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "insert into tbl_salemaster(Inv_ID,Invoiceno,Date,Salesman,Saletype,CustomerID,Customer,Grandtotal,Discount,Discountvalue,Tax,Taxvalue,Netamount,Oldbalance,Newbalance,Receivedamount,Balance,Comments) VALUES (@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13,@d14,@d15,@d16,@d17,@d18)";
                ModCommonClasses.cmd = new SqlCommand(cb);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txtinvoice.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", txt_invoice_no.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", dateTimePicker1.Value.ToString("MM/dd/yyyy"));
                ModCommonClasses.cmd.Parameters.AddWithValue("@d4", combo_salesman.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d5", combo_bil_type.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d6", txtCus_ID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d7", txtCustomerName.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d8", txt_total_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d9", combo_DiscountType.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d10", txt_dis_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d11", combo_TaxType.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d12", txt_tax_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d13", txt_Total.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d14", txt_old_bal.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d15", txt_new_bal.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d16", txt_rec_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d17", txt_dues.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d18", txt_comment.Text);


                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();



                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb1 = "insert into tbl_Temp_sale_product(InvoiceID,Productcode,Barcode,Invoiceno,Date,Customer,Productname,Price,Qty,Typeofunit,Total) VALUES (@sId,@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10)";
                ModCommonClasses.cmd            = new SqlCommand(cb1);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                // Prepare command for repeated execution
                ModCommonClasses.cmd.Prepare();
                // Data to be inserted
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        ModCommonClasses.cmd.Parameters.AddWithValue("@sId", txtinvoice.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txt_invoice_no.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d4", dateTimePicker1.Value.ToString("MM/dd/yyyy"));
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txtCustomerName.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d6", row.Cells[2].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d7", row.Cells[3].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d8", row.Cells[4].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d9", row.Cells[5].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d10", row.Cells[6].Value);

                        ModCommonClasses.cmd.ExecuteNonQuery();
                        ModCommonClasses.cmd.Parameters.Clear();
                    }
                }
                ModCommonClasses.con.Close();



                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb2 = "insert into tbl_sale_pro(InvoiceID,Productcode,Barcode,Invoiceno,Date,Customer,Productname,Price,Qty,Typeofunit,Total) VALUES (@sId,@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10)";
                ModCommonClasses.cmd            = new SqlCommand(cb2);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                // Prepare command for repeated execution
                ModCommonClasses.cmd.Prepare();
                // Data to be inserted
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        ModCommonClasses.cmd.Parameters.AddWithValue("@sId", txtinvoice.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txt_invoice_no.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d4", dateTimePicker1.Value.ToString("MM/dd/yyyy"));
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txtCustomerName.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d6", row.Cells[2].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d7", row.Cells[3].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d8", row.Cells[4].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d9", row.Cells[5].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d10", row.Cells[6].Value);

                        ModCommonClasses.cmd.ExecuteNonQuery();
                        ModCommonClasses.cmd.Parameters.Clear();
                    }
                }
                ModCommonClasses.con.Close();
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        ModCommonClasses.con = new SqlConnection(ModCS.cs);
                        ModCommonClasses.con.Open();
                        string ctx = "select Productcode from Temp_Stock where Productcode=@d1 and Barcodeno=@d2";
                        ModCommonClasses.cmd            = new SqlCommand(ctx);
                        ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                        ModCommonClasses.rdr = ModCommonClasses.cmd.ExecuteReader();
                        if ((ModCommonClasses.rdr.Read()))
                        {
                            ModCommonClasses.con = new SqlConnection(ModCS.cs);
                            ModCommonClasses.con.Open();
                            string cb3 = "Update Temp_Stock set Quantity = Quantity - " + row.Cells[4].Value + " where Productcode=@d1 and Barcodeno=@d2";
                            ModCommonClasses.cmd            = new SqlCommand(cb3);
                            ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                            ModCommonClasses.cmd.ExecuteReader();
                            ModCommonClasses.con.Close();
                        }
                    }
                }



                if (combo_bil_type.SelectedIndex == 1)
                {
                    ModFunc.CustomerLedgerSave(dateTimePicker1.Text, txtCustomerID.Text, txtCustomerName.Text, "Sale Credit", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txt_cus_mob.Text);
                }

                if (combo_bil_type.SelectedIndex == 0)
                {
                    ModFunc.CustomerLedgerSave(dateTimePicker1.Text, txtCustomerID.Text, txtCustomerName.Text, "Sale Credit", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txt_cus_mob.Text);
                    ModFunc.CustomerLedgerSave(dateTimePicker1.Text, txtCustomerID.Text, "Cash Account", "Payment", Convert.ToDecimal(txt_rec_amount.Text), 0, txt_cus_mob.Text);
                }


                if (combo_bil_type.SelectedIndex == 1)
                {
                    ModFunc.LedgerSaveInvoice(dateTimePicker1.Text, txtCustomerID.Text, txtCustomerName.Text, "Sale Credit", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txt_cus_mob.Text);
                }


                if (combo_bil_type.SelectedIndex == 0)
                {
                    ModFunc.LedgerSaveInvoice(dateTimePicker1.Text, txtCustomerID.Text, txtCustomerName.Text, "Sale Credit", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txt_cus_mob.Text);
                    ModFunc.LedgerSaveInvoice(dateTimePicker1.Text, txtCustomerID.Text, "Cash Account", "Payment", Convert.ToDecimal(txt_rec_amount.Text), 0, txt_cus_mob.Text);
                }



                printDocument1.Print();
                ModFunc.LogFunc(lblUser.Text, "Added the New Sale Having Invoice No. '" + txt_invoice_no.Text + "'");
                MessageBox.Show("Successfully Saved", "Stock", MessageBoxButtons.OK, MessageBoxIcon.Information);

                stockid();
                this.ActiveControl = txt_pro_name;
                txt_pro_name.Focus();

                btn_save.Enabled = false;
                btnnew.Enabled   = true;



                ModCommonClasses.con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #21
0
ファイル: frmLogin.cs プロジェクト: glcc4it/inventory
        private void btn_login_Click(object sender, EventArgs e)
        {
            if (Username.Text.Trim(' ').Length == 0)
            {
                MessageBox.Show("Please enter user id", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Username.Focus();
                return;
            }
            if (Username.Text.Trim(' ').Length == 0)
            {
                MessageBox.Show("Please enter password", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Password.Focus();
                return;
            }
            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                ModCommonClasses.cmd             = ModCommonClasses.con.CreateCommand();
                ModCommonClasses.cmd.CommandText = "SELECT RTRIM(UserID),RTRIM(Password) FROM tbl_login where UserType = @d1 and Name = @d2 and Password=@d3 and Active='Yes'";
                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", combo_type.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", Username.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", ModFunc.Encrypt(Password.Text));
                ModCommonClasses.rdr = ModCommonClasses.cmd.ExecuteReader();
                if (ModCommonClasses.rdr.Read())
                {
                    ModCommonClasses.con = new SqlConnection(ModCS.cs);
                    ModCommonClasses.con.Open();
                    ModCommonClasses.cmd             = ModCommonClasses.con.CreateCommand();
                    ModCommonClasses.cmd.CommandText = "SELECT usertype FROM tbl_login where UserType=@d4 and Name=@d5 and Password=@d6";
                    ModCommonClasses.cmd.Parameters.AddWithValue("@d4", combo_type.Text);
                    ModCommonClasses.cmd.Parameters.AddWithValue("@d5", Username.Text);
                    ModCommonClasses.cmd.Parameters.AddWithValue("@d6", ModFunc.Encrypt(Password.Text));
                    ModCommonClasses.rdr = ModCommonClasses.cmd.ExecuteReader();
                    if (ModCommonClasses.rdr.Read())
                    {
                    }
                    if (ModCommonClasses.rdr != null)
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    if (ModCommonClasses.con.State == ConnectionState.Open)
                    {
                        ModCommonClasses.con.Close();
                    }


                    string st = "Successfully logged in";
                    ModFunc.LogFunc(Username.Text, st);
                    this.Hide();
                    Dashboard ss = new Dashboard();
                    ss.Show();

                    ss.lblUser.Text     = Username.Text;
                    ss.lblUserType.Text = combo_type.Text;
                }
                else
                {
                    Interaction.MsgBox("Login is Failed...Try again !", MsgBoxStyle.Critical, "Login Denied");
                    Username.Text = "";
                    Password.Text = "";
                    Username.Focus();
                }
                ModCommonClasses.cmd.Dispose();
                ModCommonClasses.con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #22
0
        private void btnSave2_Click(object sender, EventArgs e)
        {
            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "insert into Payment(TransactionID, Date, PaymentMode, AccountID, Oldbalance,Amount,Balanceamount,PaymentModeDetails) VALUES (@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8)";
                ModCommonClasses.cmd = new SqlCommand(cb);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txtTransactionNo.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", dtpTranactionDate.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", cmbPaymentMode.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d4", txtID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txt_old_bal.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d6", txt_paid_amount.Text);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d7", txt_dues.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d8", txtPaymentModeDetails.Text);

                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();



                if (cmbPaymentMode.SelectedIndex == 0)
                {
                    ModFunc.SupplierLedgerSaveInvoice(dtpTranactionDate.Text, txtAccountID.Text, "Cash Account", "Payment", Convert.ToDecimal(txt_paid_amount.Text), 0, txtContactNo.Text);
                }


                if (cmbPaymentMode.SelectedIndex == 1 | cmbPaymentMode.SelectedIndex == 2)
                {
                    ModFunc.SupplierLedgerSaveInvoice(dtpTranactionDate.Text, txtAccountID.Text, "Bank Account", "Payment to " + txtAccountName.Text + "", Convert.ToDecimal(txt_paid_amount.Text), 0, txtContactNo.Text);
                }



                if (cmbPaymentMode.SelectedIndex == 0)
                {
                    ModFunc.LedgerSave(dtpTranactionDate.Text, txtAccountID.Text, "Cash Account", "Payment", Convert.ToDecimal(txt_paid_amount.Text), 0, txtContactNo.Text);
                }


                if (cmbPaymentMode.SelectedIndex == 1 | cmbPaymentMode.SelectedIndex == 2)
                {
                    ModFunc.LedgerSave(dtpTranactionDate.Text, txtAccountID.Text, "Bank Account", "Payment to " + txtAccountName.Text + "", Convert.ToDecimal(txt_paid_amount.Text), 0, txtContactNo.Text);
                }



                ModFunc.LogFunc(lblUser.Text, "Added the New Payment Having Transaction No. '" + txtTransactionNo.Text + "'");
                MessageBox.Show("Successfully Saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                transid();
                DisplayData2();
                ClearData2();
                btnSave.Enabled = false;
                ModCommonClasses.con.Close();
                this.ActiveControl = txtAccountID;
                txtAccountID.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #23
0
ファイル: Purchaseproduct.cs プロジェクト: glcc4it/inventory
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select Invoiceno from tbl_purchase where Invoiceno=@d1";
                ModCommonClasses.cmd = new SqlCommand(ct);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txt_invoice.Text);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();
                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("Invoice No. Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_invoice.Text = "";
                    txt_invoice.Focus();
                    if ((ModCommonClasses.rdr != null))
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }
                ModCommonClasses.con.Close();


                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb = "insert into tbl_purchase(ST_ID,Invoiceno,Invoicedate,Venderinvoice,Venderinvoicedate,PurchaseType,SupplierID,Suppliercode,Suppliername,Grandtotal,Discount,Discountvalue,Tax,Taxvalue,Netamount,Oldbalance,Newbalance,Paidamount,Duesamount,Comments) VALUES (@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13,@d14,@d15,@d16,@d17,@d18,@d19,@d20)";
                ModCommonClasses.cmd = new SqlCommand(cb);

                ModCommonClasses.cmd.Parameters.AddWithValue("@d1", txtST_ID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d2", txt_invoice.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d3", dateTimePicker1.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d4", txt_ven_invoice.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d5", dateTimePicker2.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d6", combo_pur_type.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d7", txtSup_ID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d8", txtSupplierID.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d9", txtSupplierName.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d10", txt_total_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d11", txt_discount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d12", txt_dis_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d13", txt_tax.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d14", txt_tax_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d15", txt_net_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d16", txt_old_bal.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d17", txt_new_bal.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d18", txt_paid_amount.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d19", txt_dues.Text);
                ModCommonClasses.cmd.Parameters.AddWithValue("@d20", txt_comments.Text);


                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteNonQuery();
                ModCommonClasses.con.Close();



                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb1 = "insert into tbl_Temp_pur_product(StockID,Productcode,Barcode,Invoiceno,Date,Suppliername,Productname,Typeofunit,Description,Purchaseprice,Qty,Total,Mfd,Expdate) VALUES (@sId,@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13)";
                ModCommonClasses.cmd            = new SqlCommand(cb1);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                // Prepare command for repeated execution
                ModCommonClasses.cmd.Prepare();
                // Data to be inserted
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        ModCommonClasses.cmd.Parameters.AddWithValue("@sId", txtST_ID.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txt_invoice.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d4", dateTimePicker1.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txtSupplierName.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d6", row.Cells[2].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d7", row.Cells[3].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d8", row.Cells[4].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d9", row.Cells[5].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d10", row.Cells[6].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d11", row.Cells[7].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d12", row.Cells[8].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d13", row.Cells[9].Value);

                        ModCommonClasses.cmd.ExecuteNonQuery();
                        ModCommonClasses.cmd.Parameters.Clear();
                    }
                }
                ModCommonClasses.con.Close();



                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string cb4 = "insert into tbl_pur_product(StockID,Productcode,Barcode,Invoiceno,Date,Suppliername,Productname,Typeofunit,Description,Purchaseprice,Qty,Total,Mfd,Expdate) VALUES (@sId,@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13)";
                ModCommonClasses.cmd            = new SqlCommand(cb4);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                // Prepare command for repeated execution
                ModCommonClasses.cmd.Prepare();
                // Data to be inserted
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        ModCommonClasses.cmd.Parameters.AddWithValue("@sId", txtST_ID.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d3", txt_invoice.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d4", dateTimePicker1.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d5", txtSupplierName.Text);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d6", row.Cells[2].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d7", row.Cells[3].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d8", row.Cells[4].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d9", row.Cells[5].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d10", row.Cells[6].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d11", row.Cells[7].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d12", row.Cells[8].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d13", row.Cells[9].Value);

                        ModCommonClasses.cmd.ExecuteNonQuery();
                        ModCommonClasses.cmd.Parameters.Clear();
                    }
                }
                ModCommonClasses.con.Close();
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        ModCommonClasses.con = new SqlConnection(ModCS.cs);
                        ModCommonClasses.con.Open();
                        string ctx = "select Productcode from Temp_Stock where Productcode=@d1 and Barcodeno=@d2";
                        ModCommonClasses.cmd            = new SqlCommand(ctx);
                        ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                        ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                        ModCommonClasses.rdr = ModCommonClasses.cmd.ExecuteReader();
                        if ((ModCommonClasses.rdr.Read()))
                        {
                            ModCommonClasses.con = new SqlConnection(ModCS.cs);
                            ModCommonClasses.con.Open();
                            string cb2 = "Update Temp_Stock set Quantity = Quantity + " + row.Cells[6].Value + " where Productcode=@d1 and Barcodeno=@d2";
                            ModCommonClasses.cmd            = new SqlCommand(cb2);
                            ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);
                            ModCommonClasses.cmd.ExecuteReader();
                            ModCommonClasses.con.Close();
                        }
                        else
                        {
                            ModCommonClasses.con = new SqlConnection(ModCS.cs);
                            ModCommonClasses.con.Open();
                            string cb3 = "insert into Temp_Stock(ProductCode,Barcodeno,Product,Typeofunit,Description,Purchaseprice,Quantity,Mfd,Expdate) VALUES (@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9)";
                            ModCommonClasses.cmd            = new SqlCommand(cb3);
                            ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d1", row.Cells[0].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d2", row.Cells[1].Value);

                            ModCommonClasses.cmd.Parameters.AddWithValue("@d3", row.Cells[2].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d4", row.Cells[3].Value);

                            ModCommonClasses.cmd.Parameters.AddWithValue("@d5", row.Cells[4].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d6", row.Cells[5].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d7", row.Cells[6].Value);
                            ModCommonClasses.cmd.Parameters.AddWithValue("@d8", row.Cells[7].Value);

                            ModCommonClasses.cmd.Parameters.AddWithValue("@d9", row.Cells[8].Value);


                            ModCommonClasses.cmd.ExecuteReader();
                            ModCommonClasses.con.Close();
                        }
                    }
                }



                if (combo_pur_type.SelectedIndex == 1)
                {
                    ModFunc.SupplierLedgerSaveInvoice(dateTimePicker1.Text, txtSupplierID.Text, txtSupplierName.Text, "Purchase", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txtContactNo.Text);
                }


                if (combo_pur_type.SelectedIndex == 0)
                {
                    ModFunc.SupplierLedgerSaveInvoice(dateTimePicker1.Text, txtSupplierID.Text, txtSupplierName.Text, "Purchase", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txtContactNo.Text);
                    ModFunc.SupplierLedgerSaveInvoice(dateTimePicker1.Text, txtSupplierID.Text, "Cash Account", "Payment", Convert.ToDecimal(txt_paid_amount.Text), 0, txtContactNo.Text);
                }



                if (combo_pur_type.SelectedIndex == 1)
                {
                    ModFunc.LedgerSaveInvoice(dateTimePicker1.Text, txtSupplierID.Text, txtSupplierName.Text, "Purchase", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txtContactNo.Text);
                }


                if (combo_pur_type.SelectedIndex == 0)
                {
                    ModFunc.LedgerSaveInvoice(dateTimePicker1.Text, txtSupplierID.Text, txtSupplierName.Text, "Purchase", 0, Convert.ToDecimal(txt_new_bal.Text) - Convert.ToDecimal(txt_old_bal.Text), txtContactNo.Text);
                    ModFunc.LedgerSaveInvoice(dateTimePicker1.Text, txtSupplierID.Text, "Cash Account", "Payment", Convert.ToDecimal(txt_paid_amount.Text), 0, txtContactNo.Text);
                }



                ModFunc.LogFunc(lblUser.Text, "Added the New Purchase Having Invoice No. '" + txt_invoice.Text + "'");
                MessageBox.Show("Successfully Saved", "Stock", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.ActiveControl = txt_product;
                txt_product.Focus();

                btnSave.Enabled = false;
                btnNew.Enabled  = true;

                ModCommonClasses.con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (combo_status.SelectedIndex == 0)
            {
                st1 = "Yes";
            }
            else
            {
                st1 = "No";
            }

            if (txt_DiscountName.Text == "")
            {
                MessageBox.Show("Please Enter Discount Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_DiscountName.Focus();
                return;
            }


            try
            {
                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();
                string ct = "select DiscountName from tbl_discount where DiscountName='" + txt_DiscountName.Text + "'";

                ModCommonClasses.cmd            = new SqlCommand(ct);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.rdr            = ModCommonClasses.cmd.ExecuteReader();

                if (ModCommonClasses.rdr.Read())
                {
                    MessageBox.Show("DiscountName Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_DiscountName.Text = "";
                    txt_DiscountName.Focus();


                    if (ModCommonClasses.rdr != null)
                    {
                        ModCommonClasses.rdr.Close();
                    }
                    return;
                }

                ModCommonClasses.con = new SqlConnection(ModCS.cs);
                ModCommonClasses.con.Open();

                string cb = "insert into tbl_discount(DiscountName,DiscountPercentage,Status) VALUES ('" + txt_DiscountName.Text + "' ,'" + txt_DiscountPercent.Text + "' , '" + st1 + "')";

                ModCommonClasses.cmd            = new SqlCommand(cb);
                ModCommonClasses.cmd.Connection = ModCommonClasses.con;
                ModCommonClasses.cmd.ExecuteReader();
                ModCommonClasses.con.Close();
                MessageBox.Show("Successfully Saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ModFunc.LogFunc(lblUser.Text, "Add the Discount '" + txt_DiscountName.Text + "' Having DiscountID '" + txtID.Text + "'");
                this.ActiveControl = txt_DiscountName;
                txt_DiscountName.Focus();
                DisplayData();
                ClearData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }