Ejemplo n.º 1
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            TapalPickDB tpdb = new TapalPickDB();

            prevtapal.Date = UpdateTable.getSQLDateTime();
            try
            {
                if (list.Count != 0)
                {
                    if (tpdb.insertTapalDistribution(list, prevtapal))
                    {
                        string menuID = getMenuID();
                        try
                        {
                            string toAddress = "";
                            toAddress = ERPUserDB.getemailIDs(list, menuID);
                            //create emaildata
                            if (toAddress.Trim().Length > 0)
                            {
                                EmailDataDB emdataDB = new EmailDataDB();
                                emaildata   emdata   = new emaildata();
                                emdata.ToAddress = toAddress;
                                emdata.status    = 0;
                                emdata.EmailData = "Tapal from " + prevtapal.ReceivedFrom + " is forwarded to you by " + Login.userLoggedInName;
                                emdata.Subject   = "Tapal From " + prevtapal.ReceivedFrom;
                                emdataDB.insertEmailData(emdata);
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                        //
                        tpdb.updateTapalStatus(prevtapal);
                        pnlDistrbutor.Visible = false;
                        grdList.Enabled       = true;
                        btnPickFile.Enabled   = true;
                        listtapal();
                    }
                    else
                    {
                        MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error 1");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error 2");
            }
        }
Ejemplo n.º 2
0
        private void btnReset_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (txtUserID.Text == "" || txtEmpName.Text == "")
                {
                    MessageBox.Show("Please Select the UserID");
                }
                else
                {
                    if (MessageBox.Show("Are you sure to reset Password of " + txtEmpName.Text + "?",
                                        "Password Reset", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
                        == DialogResult.OK)
                    {
                        string newPassword = showrandom();

                        //send email to user
                        string menuID = getMenuID();
                        try
                        {
                            string toAddress = "";
                            string empID     = ERPUserDB.getUserEmployeeID(txtUserID.Text);
                            toAddress = EmployeeDB.getEmployeeEmailID(empID);
                            //create emaildata
                            if (toAddress.Trim().Length > 0)
                            {
                                EmailDataDB emdataDB = new EmailDataDB();
                                emaildata   emdata   = new emaildata();
                                emdata.ToAddress = toAddress;
                                emdata.status    = 0;
                                emdata.EmailData = "Your new ERP password is " + newPassword + "\n" + Login.userLoggedInName;
                                emdataDB.insertEmailData(emdata);
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                        closeAllPanels();
                        clearUserData();
                        enableBottomButtons();
                        pnlUserList.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }