Ejemplo n.º 1
0
        public bool VerifyAppointment(int verifyUserID, string verifyUserPassword, int nAppointmentID)
        {
            TblEmployee verifyUser = new TblEmployee();

            verifyUser.NEmployeeID = verifyUserID;

            verifyUser.SelectOne();

            if (verifyUser.StrPassword.IsNull)
            {
                throw new Exception("Invalid User ID or Password");
            }

            if (verifyUser.StrPassword.Value != verifyUserPassword)
            {
                throw new Exception("Invalid User ID or Password");
            }

            TblAppointment myAppointment = new TblAppointment();

            myAppointment.NAppointmentId = nAppointmentID;
            myAppointment.SelectOne();

            if (!myAppointment.NVerifiedBy.IsNull)
            {
                throw new Exception("This appointment have been verified by other staff with the employee ID : " + myAppointment.NVerifiedBy.Value.ToString());
            }

            myAppointment.NVerifiedBy = verifyUserID;
            //myAppointment.NStatus = 1;
            myAppointment.Update();
            return(true);
        }
Ejemplo n.º 2
0
        public bool Login(string nEmployeeID, string strPassword)
        {
            TblEmployee oEmployee = new TblEmployee();
            DataTable   dtEmployee;
            int         rowCount;

            ACMSDAL.TblEmployee emp = new ACMSDAL.TblEmployee();
            DataTable           dt  = emp.SelectAll();

            int empId = int.MinValue;

            DataRow row;

            foreach (DataRow tempLoopVar_row in dt.Rows)
            {
                row = tempLoopVar_row;
                if (row["strEmployeeName"].ToString() == nEmployeeID)
                {
                    empId = System.Convert.ToInt32(row[0].ToString());
                }
            }

            oEmployee.NEmployeeID = new SqlInt32(empId);
            oEmployee.StrPassword = new SqlString(strPassword.Trim());

            try
            {
                dtEmployee = oEmployee.SelectOne();
                rowCount   = dtEmployee.Rows.Count;

                if (dtEmployee.Rows.Count > 0)
                {
                    DataRow dr;
                    dr = dtEmployee.Rows[0];

                    if (rowCount > 0 && dr[2].ToString() == strPassword)
                    {
                        EmployeeID      = oEmployee.NEmployeeID.Value;
                        EmployeeName    = oEmployee.StrEmployeeName.ToString();
                        JobPositionCode = oEmployee.StrJobPositionCode.ToString();
                        BranchCode      = oEmployee.StrBranchCode.ToString();
                        RightsLevelID   = oEmployee.NRightsLevelID.Value;
                        DepartmentID    = oEmployee.NDepartmentID.Value;
                        dtCessation     = System.Convert.ToDateTime(oEmployee.DtCessation.Value);
                        //RoadShow= ch
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
//				oEmployee.Dispose();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            return(true);
        }
Ejemplo n.º 3
0
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            //if (DateTime.Compare(dtEdtStartTime.DateTime.Date, DateTime.Today.Date) < 0)
            //{
            //    if (oUser.NRightsLevelID() >= 1003 &&  oUser.NRightsLevelID() <= 1004 )
            //    {
            //        MessageBox.Show(this, "Invalid Date. Pls choose other date.");
            //        this.DialogResult   = DialogResult.None;
            //        return;
            //    }

            //}

            if (lkpEdtBranchCode.Text == "")
            {
                MessageBox.Show(this, "Please select a branch.");
                this.DialogResult = DialogResult.None;
                //return;
            }
            else if (lkpEdtEmployeeID.Text == "")
            {
                MessageBox.Show(this, "Please select a therapist");
                this.DialogResult = DialogResult.None;
                //return;
            }
            else if (lkpEdtServiceCode.Text == "")
            {
                MessageBox.Show(this, "Please select a treatment.");
                this.DialogResult = DialogResult.None;
                //return;
            }
            else
            {
                try
                {
                    TblEmployee myTherapist = new TblEmployee();
                    myTherapist.NEmployeeID = this.TherapistID;
                    DataTable     tblTherapist            = myTherapist.SelectOne();
                    MemberPackage myMemPackage            = new MemberPackage();
                    DataTable     tblMemberPackageBalance = MemberPackage.CalculateMemberPackageBalance(this.ServiceCode, myMemberShipID, myPackageID);

                    myPackageBalance = (Convert.ToInt32(tblMemberPackageBalance.Rows[0]["Balance"].ToString()) - Convert.ToInt32(this.NQuantity));

                    string strBalance    = myPackageBalance.ToString();
                    string strTherapist  = tblTherapist.Rows[0]["strEmployeeName"].ToString();
                    string strDateTime   = DateTime.Now.ToString("dd/MM/yyyy  hh:mm:ss tt");
                    string strDateTimeMM = DateTime.Now.ToString("dd/MM/yyyy  hh:mm tt");
                    string strExpiryDate = Convert.ToDateTime(tblMemberPackageBalance.Rows[0]["dtExpiryDate"]).ToString("dd/MM/yyyy");

                    //** Insert Signature eric 15052009
                    //==================================
                    string strSignatureID   = "";
                    string strKeyData       = "";
                    string strPdfExportPath = "";

                    //int mySessionID = 0;

                    DataTable dtss = new DataTable();
                    dtss.Columns.Add("nSessionID", typeof(int));
                    dtss.Columns.Add("strMembershipID", typeof(string));
                    mydtSessionID = dtss;

                    //Key data format for Spa Service Utilisation
                    //MemberID|DateTime|ExpiryDate|Branch|Therapist|PkgCode|ServCode|Qty|Bal
                    strPdfExportPath = (string)ConfigurationSettings.AppSettings["SaveSpaServiceReceiptPath"].ToString() + "\\" + User.BranchCode + "\\" + myMemberShipID.Trim() + "_" + strDateTime.Replace(":", "").Replace(" ", "").Replace("/", "") + ".pdf";
                    strKeyData       = myMemberShipID.Trim() + "|" + strExpiryDate + "|" + this.BranchCode + "|" + strTherapist + "|" + myPackageCode + "|" + this.ServiceCode + "|" + strBalance + "|" + this.NQuantity;

                    myKeyData = strKeyData;

                    if (myPackageCategoryID == 4 || myPackageCategoryID == 5 || myPackageCategoryID == 6 || myPackageCategoryID == 34)
                    {
                        MemberPackage myMemberPackage = new MemberPackage();

                        myMemberPackage.NewServiceSession(myPackageID, this.ServiceCode, myMemberShipID.Trim(),
                                                          this.TherapistID, this.BranchCode, this.Date, this.StartTime, this.TreatmentDate, strSignatureID,
                                                          System.Convert.ToInt32(this.NQuantity), false, myPackageCategoryID, strKeyData,
                                                          strPdfExportPath, ref mydtSessionID, this.SsRemark);
                    }
                    else
                    {
                        MemberPackage myMemberPackage = new MemberPackage();

                        myMemberPackage.NewServiceSession(myPackageID, this.ServiceCode, myMemberShipID.Trim(),
                                                          this.TherapistID, this.BranchCode, this.Date, this.StartTime, this.TreatmentDate, strSignatureID,
                                                          System.Convert.ToInt32(this.NQuantity), false, myPackageCategoryID, "", "", this.SsRemark);
                    }

                    bool outputPrint = false;

                    //Derek From Credit Package Usage Do not print
                    if (!myIsFromCreditUsage)
                    {
                        if (myPackageCategoryID == 4 || myPackageCategoryID == 5 || myPackageCategoryID == 6 || myPackageCategoryID == 34)
                        {
                            DigSignature frmSig  = new DigSignature(strKeyData, "ServiceUtilisation", null, null, dtServiceUtilization);
                            DialogResult result1 = frmSig.ShowDialog();

                            if (result1 == DialogResult.OK)
                            {
                                strSignatureID = frmSig.ShowSignature();

                                //**DEREK Update Service Session Signature ID **
                                try
                                {
                                    foreach (DataRow row in mydtSessionID.Rows)
                                    {
                                        //Derek Need Fixing Here - Update only strSignatureID and strPdfExportPath
                                        TblServiceSession myServiceSessionSigPath = new TblServiceSession();

                                        if (strSignatureID.Trim() != "" && strSignatureID.Trim() != "300D0A300D0A")
                                        {
                                            myServiceSessionSigPath.UpdateServiceSessionSigPdfPath(strSignatureID, strKeyData, strPdfExportPath, Convert.ToInt32(row["nSessionID"]), myMemberShipID);
                                        }
                                        else
                                        {
                                            myServiceSessionSigPath.UpdateServiceSessionSigPdfPath(strPdfExportPath, Convert.ToInt32(row["nSessionID"]), myMemberShipID);
                                        }
                                    }
                                }
                                catch { }

                                outputPrint = true;

                                /*if (strSignatureID == null || strSignatureID == "")
                                 * {
                                 *  DialogResult yes = MessageBox.Show(this, "Member haven't signed on signature pad. Confirm to print?", "Warning", MessageBoxButtons.YesNo);
                                 *  if (yes == DialogResult.No)
                                 *      return;
                                 * }*/

                                //============================================
                                //InitMemberPackage(CurrentMembershipID);
                                //OnMemberPackageGridFocusRowChanged();
                            }

                            //OnPrintMemberPackageUsage(tblTherapist.Rows[0]["strEmployeeName"].ToString(), CurrentMembershipID, MemberPackageStrPackageCode, frm.ServiceCode, strBalance);//eric 18052009
                            //**Call Print Package A/C report
                            //rpt.PrintRpt(strSignatureID, CurrentMembershipID, strDateTime, frm.BranchCode, strTherapist, MemberPackageStrPackageCode, frm.ServiceCode, strBalance);

                            PackageAccountRpt rpt = new PackageAccountRpt();

                            rpt.PrintRpt("Therapist Name :", strSignatureID, strKeyData, myMemberShipID.Trim(), strDateTimeMM, strExpiryDate, this.BranchCode, strTherapist, myPackageCode, this.ServiceCode, strBalance, this.NQuantity);
                            rpt.ExportToPdf(strPdfExportPath);

                            if (outputPrint)
                            {
                                rpt.Print();
                            }
                        }
                    }
                    else
                    {
                        if (myPackageCategoryID == 4 || myPackageCategoryID == 5 || myPackageCategoryID == 6 || myPackageCategoryID == 34)
                        {
                            //Update DataTable
                            DataTable dt = new DataTable();
                            dt.Columns.Add("Caption", typeof(string));
                            dt.Columns.Add("MemberID", typeof(string));
                            dt.Columns.Add("DateTime", typeof(string));
                            dt.Columns.Add("ExpiryDate", typeof(string));
                            dt.Columns.Add("BranchCode", typeof(string));
                            dt.Columns.Add("StaffName", typeof(string));
                            dt.Columns.Add("PackageCode", typeof(string));
                            dt.Columns.Add("PackageDesc", typeof(string));//lblPackageDesc.Text
                            dt.Columns.Add("ServiceCode", typeof(string));
                            dt.Columns.Add("Balance", typeof(string));
                            dt.Columns.Add("Quantity", typeof(int));
                            //dt.Columns.Add("mySessionID", typeof(int));
                            //DEREK Need Fixing Here - Need A Different DataTable to Store SessionID

                            dt.Rows.Add("Therapist Name :", myMemberShipID.Trim(), strDateTimeMM, strExpiryDate, this.BranchCode, strTherapist, myPackageCode,
                                        lblPackageDesc.Text.ToString(), this.ServiceCode, strBalance, this.NQuantity);

                            mydtServiceUtilization = dt;
                        }
                    }
                }

                catch (Exception ex)
                {
                    this.DialogResult = DialogResult.None;

                    MessageBox.Show(this, ex.Message);
                }
            }
        }