コード例 #1
0
        public DSMemberProgress  GetMemberProgress(Performance d, string fromdate, string todate)
        {
            DSMemberProgress ds = new DSMemberProgress();

            try
            {
                string Donors = "";
                string all    = "";
                if (d.MemberName != null && d.MemberName != "")
                {
                    Donors = "Select * from Performance Where MemberName='" + d.MemberName + "' and PerformanceDate>=#" + fromdate + "# and PerformanceDate<=#" + todate + "#";
                }
                else
                {
                    all = "Select * from Performance";
                }



                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    string select = "";
                    if (d.MemberName != null && d.MemberName != "")
                    {
                        select = Donors;
                    }
                    else
                    {
                        select = all;
                    }

                    da = new OleDbDataAdapter(select, con);
                    da.Fill(ds, ds.Tables[0].TableName);
                }


                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #2
0
        public DSDonorCollection GetDonorCollectionData(DonorCollection d, string fromdate, string todate, bool All)
        {
            DSDonorCollection ds = new DSDonorCollection();

            try
            {
                string Donors = "";
                string all    = "";
                if (All == false)
                {
                    Donors = "Select * from DonorCollection Where DonorName='" + d.DonorName + "' and CollectionDate>='" + fromdate + "' and CollectionDate<='" + todate + "'";
                }
                else if (All == true)
                {
                    all = "Select * from DonorCollection where CollectionDate>='" + fromdate + "' and CollectionDate<='" + todate + "'";
                }



                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    string select = "";
                    if (d.DonorName != null && d.DonorName != "")
                    {
                        select = Donors;
                    }
                    else
                    {
                        select = all;
                    }

                    da = new OleDbDataAdapter(select, con);
                    da.Fill(ds, ds.Tables[0].TableName);
                }


                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #3
0
        public List <Membership> GetFee(Membership mem, bool donor, bool member)
        {
            try
            {
                //  List<object> obj = new List<object>();

                List <Membership> members = new List <Membership>();
                string            select  = "";
                if (member == true)
                {
                    select = "SELECT MonthlyFee from MembershipData where MemberName='" + mem.MemberName + "'";
                }
                else if (donor == true)
                {
                    select = "SELECT DonorFee from Donor where DonorName='" + mem.Donor.DonorName + "'";
                }
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(select, con);
                cmd.Transaction = tran;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Membership m = new Membership();
                    Donor      d = new Donor();
                    if (member == true)
                    {
                        m.MonthlyFee = dr["MonthlyFee"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["MonthlyFee"]);
                    }
                    else
                    {
                        m.Donor.DonorFee = dr["DonorFee"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["DonorFee"]);
                    }
                    members.Add(m);
                }
                dr.Close();
                tran.Commit();
                return(members);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #4
0
ファイル: DonorDAL.cs プロジェクト: ArishSultan/ycdo__old
        public List <Donor> GetDonorData()
        {
            try
            {
                doners = new List <Donor>();
                string insert = "Select * from Donor";

                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Donor m = new Donor();
                    m.MID = dr["MID"] == System.DBNull.Value ? 0 : Convert.ToInt32(dr["MID"]);
                    m.branch.BranchName = dr["BranchName"] == System.DBNull.Value ? null : Convert.ToString(dr["BranchName"]);
                    m.DonorNo           = dr["DonorNo"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["DonorNo"]);
                    m.DonorName         = dr["DonorName"] == System.DBNull.Value ? null : Convert.ToString(dr["DonorName"]);
                    m.NIC            = dr["NIC"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["NIC"]);
                    m.DonorFee       = dr["DonorFee"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["DonorFee"]);
                    m.BloodGroup     = dr["Bloodgroup"] == System.DBNull.Value ? null : Convert.ToString(dr["Bloodgroup"]);
                    m.DonorLastName  = dr["DonorLastName"] == System.DBNull.Value ? null : Convert.ToString(dr["DonorLastName"]);
                    m.Gender         = dr["Gender"] == System.DBNull.Value ? null : Convert.ToString(dr["Gender"]);
                    m.Phone          = dr["Phone"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Phone"]);
                    m.Refrence       = dr["Refrence"] == System.DBNull.Value ? null : Convert.ToString(dr["Refrence"]);
                    m.Adress         = dr["Adress"] == System.DBNull.Value ? null : Convert.ToString(dr["Adress"]);
                    m.Email          = dr["Email"] == System.DBNull.Value ? null : Convert.ToString(dr["Email"]);
                    m.Status         = dr["Status"] == System.DBNull.Value ? null : Convert.ToString(dr["Status"]);
                    m.AGE            = dr["Age"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Age"]);
                    m.FundType       = dr["FundType"] == System.DBNull.Value ? null : Convert.ToString(dr["FundType"]);
                    m.CollectionDate = dr["CollectionDate"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["CollectionDate"]);
                    m.City.CityName  = dr["City"] == System.DBNull.Value ? null : Convert.ToString(dr["City"]);
                    m.CurrentDate    = dr["CurrentDate"] == System.DBNull.Value ? new DateTime(2012, 08, 10) : Convert.ToDateTime(dr["CurrentDate"]);


                    doners.Add(m);
                }
                dr.Close();

                tran.Commit();
                return(doners);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        public bool SaveLabtestname(LabTestName c)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran = con.BeginTransaction();

                string insert;


                int VID = 0;
                if (c.ID == 0)
                {
                    cmd             = new OleDbCommand("Select Max(ID) From LabTest", con);
                    cmd.Transaction = tran;

                    VID  = Convert.ToInt32(cmd.ExecuteScalar());
                    c.ID = VID + 1;
                    ////-------------- Insert without ID ------- Asif - 29-05-19
                    // insert = " Insert into LabTest (ID,[Test (A-Z)],Sample,Performed,Report,Deserving,Poor,YCDO,Generall,Shahab,Ghori,IsMedicine,Unit,IsRsTenInjection,IsAlwaysPaid,IsOd,PurchasePrice,RetailPrice,FixLimit)"
                    // + " values (" + c.ID + ",'" + c.TestName + "','" + c.Sample + "','" + c.Performed + "',"
                    //+ "'" + c.Report + "'," + c.Deserving + "," + c.Poor + "," + c.YCDO + "," + c.General + ","
                    //+ " " + c.Shahab + "," + c.Ghori + "," + Convert.ToInt16(c.IsMedicine) + ",'" + c.Unit + "'," + Convert.ToInt16(c.IsRsTenInjection) + "," + Convert.ToInt16(c.IsAlwaysPaid) + "," + Convert.ToInt16(c.IsOd) + "," + c.PurchasePrice + "," + c.RetailPrice + "," + c.FixedLimit + ")";
                    insert = " Insert into LabTest ([Test (A-Z)],Sample,Performed,Report,Deserving,Poor,YCDO,Generall,Shahab,Ghori,IsMedicine,Unit,IsRsTenInjection,IsAlwaysPaid,IsOd,PurchasePrice,RetailPrice,FixLimit)"
                             + " values ('" + c.TestName + "','" + c.Sample + "','" + c.Performed + "',"
                             + "'" + c.Report + "'," + c.Deserving + "," + c.Poor + "," + c.YCDO + "," + c.General + ","
                             + " " + c.Shahab + "," + c.Ghori + "," + Convert.ToInt16(c.IsMedicine) + ",'" + c.Unit + "'," + Convert.ToInt16(c.IsRsTenInjection) + "," + Convert.ToInt16(c.IsAlwaysPaid) + "," + Convert.ToInt16(c.IsOd) + "," + c.PurchasePrice + "," + c.RetailPrice + "," + c.FixedLimit + ")";
                }
                else
                {
                    insert = "Update LabTest set [Test (A-Z)]='" + c.TestName + "',Sample='" + c.Sample + "',Performed='" + c.Performed + "',Report='" + c.Report + "',Deserving=" + c.Deserving + ",Poor=" + c.Poor + ",YCDO=" + c.YCDO + ",Generall=" + c.General + ",Shahab=" + c.Shahab + ",Ghori=" + c.Ghori + ",IsMedicine=" + Convert.ToInt16(c.IsMedicine) + ",Unit='" + c.Unit + "',IsAlwaysPaid=" + Convert.ToInt16(c.IsAlwaysPaid) + ",IsRsTenInjection=" + Convert.ToInt16(c.IsRsTenInjection) + ",IsOd=" + Convert.ToInt16(c.IsOd) + ",PurchasePrice=" + c.PurchasePrice + ",RetailPrice=" + c.RetailPrice + " ,Fixlimit=" + c.FixedLimit + " where ID=" + c.ID;
                }

                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #6
0
        public DSMembership GetData(Membership mem, bool Branches, bool Cities, bool All)
        {
            DSMembership ds = new DSMembership();

            try
            {
                string branches = "Select * from MembershipData Where BranchName='" + mem.branch.BranchName + "'";


                string all = "Select * from MembershipData";


                string cities = "Select * from MembershipData Where City='" + mem.City.CityName + "'";

                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    string select = "";
                    if (Branches == true)
                    {
                        select = branches;
                    }
                    else if (Cities == true)
                    {
                        select = cities;
                    }
                    else if (All == true)
                    {
                        select = all;
                    }

                    da = new OleDbDataAdapter(select, con);
                    da.Fill(ds, ds.Tables[0].TableName);
                }


                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #7
0
        public List <RecieveMedicine> GetRecieveMedicines(string RecieveNumber)
        {
            List <RecieveMedicine> LoRec = new List <RecieveMedicine>();

            try
            {
                string    select = "Select * from ReceiveMedicine where RecievedNumber=" + RecieveNumber;
                DataTable dt     = new DataTable();
                con                  = new OleDbConnection();
                readconfile          = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    da = new OleDbDataAdapter(select, con);
                    da.Fill(dt);
                }

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        RecieveMedicine ObjRec = new RecieveMedicine();
                        ObjRec.RefRec.LineItem.LabTestId = Convert.ToInt32(row["ItemNumber"]);
                        ObjRec.RefRec.LineItem.TestName  = row["ItemName"].ToString();
                        //ObjRec.RefRec.LineItem.MedIssuedID = Convert.ToInt32(row["ID"]);
                        ObjRec.RefRec.Quantity = Convert.ToDecimal(row["Qty"]);
                        //ObjRec.RecieveDate = Convert.ToDateTime(row["RecieveDate"]);
                        //ObjRec.RecieveNumber = Convert.ToInt64(row["RecievedNumber"]);
                        ObjRec.RefRec.Price       = row["Price"] == DBNull.Value ? 0 : Convert.ToDouble(row["Price"]);
                        ObjRec.RefRec.GrossAmount = row["GrossAmount"] == DBNull.Value ? 0 : Convert.ToDouble(row["GrossAmount"]);
                        ObjRec.RefRec.NetAmount   = row["NetAmount"] == DBNull.Value ? 0 : Convert.ToDouble(row["NetAmount"]);

                        ObjRec.RefBranch.BranchID = row["BranchID"] == DBNull.Value ? 0 : Convert.ToInt16(row["BranchID"]);
                        LoRec.Add(ObjRec);
                    }
                }


                return(LoRec);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #8
0
ファイル: BranchesDAL.cs プロジェクト: ArishSultan/ycdo__old
        public bool SaveBranches(Branch br)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran = con.BeginTransaction();

                string insert;
                if (br.BranchID == 0)
                {
                    //  New Field IsActive to get Current Branch Name & Address
                    //insert = @"Insert Into Branches(BranchCode,BranchName,Phone,Adress,City)
                    //        values (" + br.BranchCode + ",'" + br.BranchName + "'," + br.Phone + ",'" + br.BranchAdress + "','" + br.City.CityName + "')";
                    insert = @"Insert Into Branches(BranchCode,BranchName,Phone,Adress,City,IsActive) 
                            values (" + br.BranchCode + ",'" + br.BranchName + "'," + br.Phone + ",'" + br.BranchAdress + "','" + br.City.CityName + "'," + Convert.ToInt16(br.IsActive) + ")";
                }
                else
                {
                    //insert = @"Update Branches set BranchCode=" + br.BranchCode + ",BranchName='" + br.BranchName + "', "
                    //    + " Phone=" + br.Phone + ",Adress='" + br.BranchAdress + "',City='" + br.City.CityName + "' where ID=" + br.BranchID + "";
                    insert = @"Update Branches set BranchCode=" + br.BranchCode + ",BranchName='" + br.BranchName + "', "
                             + " Phone=" + br.Phone + ",Adress='" + br.BranchAdress + "',City='" + br.City.CityName + "', IsActive=" + Convert.ToInt16(br.IsActive) + " where ID=" + br.BranchID + "";
                }
                // string insert = @"if exist (select * from Branches where BranchCode='" + vid + "')Begin "
                //+ " Update Branches set BranchCode='" + br.BranchCode + "',BranchName='"+br.BranchName+"', "
                // + " Phone='" + br.Phone + "',Adress='" + br.BranchAdress + "',City='"+br.City+"'"
                // + " end else Begin  Insert Into Branches(BranchCode,BranchName,Phone,Adress,City) "
                // +"  values ('" + br.BranchCode + "','" + br.BranchName + "','" + br.Phone+ "','" + br.BranchAdress+ "','"+br.City+"')";



                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();

                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #9
0
        public bool SaveUser(User user)
        {
            bool flag;

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                if (this.con.ConnectionString != "")
                {
                    this.con.Open();
                    this.cmd = new OleDbCommand();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.tran            = this.con.BeginTransaction();
                        this.cmd.Connection  = this.con;
                        this.cmd.Transaction = this.tran;
                        this.cmd.CommandText = "Select * from unames where uname='" + user.UserName + "'";
                        this.cmd.CommandType = CommandType.Text;
                        long num2 = 0L;
                        if (Convert.ToInt64(this.cmd.ExecuteScalar()) > 0L)
                        {
                            throw new Exception("User Already Exist");
                        }
                        num2 = 0L;
                        this.cmd.CommandText = "select max(UNo) from unames";
                        this.cmd.CommandType = CommandType.Text;
                        num2 = Convert.ToInt64(this.cmd.ExecuteScalar()) + 1L;
                        this.cmd.CommandText = string.Concat(new object[] { "insert into unames(UNo,UName,Upwd,isadmin) values(", num2, ",'", user.UserName, "','", Common.DataBasePassword.Encrypt(user.UserPassword), "',", Convert.ToInt16(user.IsAdmin), ")" });
                        if (this.cmd.ExecuteNonQuery() == 0)
                        {
                            this.tran.Rollback();
                            return(false);
                        }
                        this.tran.Commit();
                        this.con.Close();
                        return(true);
                    }
                }
                flag = false;
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
コード例 #10
0
        private bool HasMoreThan1Admin(User user)
        {
            bool flag2;

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                bool flag = false;
                if (this.con.ConnectionString != "")
                {
                    this.con.Open();
                    this.cmd = new OleDbCommand();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.dt              = new DataTable();
                        this.cmd.Connection  = this.con;
                        this.cmd.CommandType = CommandType.Text;
                        this.cmd.CommandText = "Select * from unames where Isadmin=1";
                        this.da              = new OleDbDataAdapter(this.cmd.CommandText, this.con);
                        this.da.Fill(this.dt);
                        if (this.dt.Rows.Count == 1)
                        {
                            if (user.Userno == Convert.ToInt32(this.dt.Rows[0]["UNo"]))
                            {
                                flag = false;
                            }
                            else
                            {
                                flag = true;
                            }
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    this.con.Close();
                }
                flag2 = flag;
            }
            catch (Exception)
            {
                throw;
            }
            return(flag2);
        }
コード例 #11
0
        public bool GetCompanyCheck()
        {
            //we have used PriID field of Attributes Table for Show Company Name and Address on Print Label Screen
            string strText = "";

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                if (this.con.ConnectionString != null)
                {
                    this.con.Open();
                    this.cmd             = new OleDbCommand();
                    this.cmd.Connection  = this.con;
                    this.cmd.CommandType = CommandType.Text;
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.cmd.Connection  = this.con;
                        this.cmd.CommandText = "Select PriID from Attributes";
                        reader   = this.cmd.ExecuteReader();
                        rowCount = reader.RecordsAffected;
                        while (reader.Read())
                        {
                            strText = reader["PriID"].ToString();
                        }
                    }
                }
                if (strText.ToUpper() == "TRUE")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #12
0
        public bool SavePatientToken(InjectionLabTest pr)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                string insert = "";
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;

                if (pr.IsInjectionToken == true)
                {
                    insert = "Insert Into InjectionLabTest(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName"
                             + ",PatientNIC,PatientAddress,TokenAmount,PatientRegistrationNumber,PatientRegistrationDate,ExistingTokenID) "
                             + "values (#" + pr.TokenDate + "#," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','"
                             + pr.Patient.NIC + "','" + pr.Patient.Address + "'," + (int)pr.CashReceived + ",'"
                             + pr.Patient.RegistrationNumber + "',#" + pr.Patient.RegistrationDate + "#,'" + pr.ExistingTokenNo + "')";
                    cmd.CommandText = insert;
                    cmd.ExecuteNonQuery();
                }
                else
                {
                    foreach (LabTest item in pr.Tests)
                    {
                        insert = "Insert Into InjectionLabTest(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName"
                                 + ",PatientNIC,PatientAddress,TokenAmount,PatientRegistrationNumber,PatientRegistrationDate,LabTestId,PatientPayType,ExistingTokenID) "
                                 + "values (#" + pr.TokenDate + "#," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','"
                                 + pr.Patient.NIC + "','" + pr.Patient.Address + "'," + (int)item.CurrentAmount + ",'"
                                 + pr.Patient.RegistrationNumber + "',#" + pr.Patient.RegistrationDate + "#," + item.LabTestId + ",'" + pr.Type.ToString() + "','" + pr.ExistingTokenNo + "')";
                        cmd.CommandText = insert;
                        cmd.ExecuteNonQuery();
                    }
                }

                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            { con.Close(); }
        }
コード例 #13
0
        public List <PatientAdmission> GetPatientAdmissionAdmit()
        {
            PatientAdmissions = new List <PatientAdmission>();
            try
            {
                string Get = " Select * from PatientAdmission where status=0 ";
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(Get, con);
                cmd.Transaction = tran;

                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    PatientAdmission c = new PatientAdmission();
                    // c. = Convert.ToInt32(dr["CityID"]);
                    c.PatientRegistration.Patient.RegistrationNumber = dr["PatientRegistrationNumber"].ToString();
                    c.PatientRegistration.Patient = new PatientDAL().GetPatientByNo(c.PatientRegistration.Patient.RegistrationNumber);
                    c.DiffDiag      = dr["DiffDiag"].ToString();
                    c.provDiag      = dr["ProvDiag"].ToString();
                    c.AdmissoinDate = dr["AdmissionDateTime"] == DBNull.Value ? DateTime.Now.Date : Convert.ToDateTime(dr["AdmissionDateTime"]);
                    c.Pluse         = Convert.ToInt32(dr["Pluse"]);
                    c.Temp          = Convert.ToInt32(dr["Temp"]);
                    c.BPsys         = Convert.ToInt32(dr["BPsys"]);
                    c.BPdia         = Convert.ToInt32(dr["BPdia"]);
                    c.RR            = dr["RR"].ToString();
                    //  c.CityName = dr["CityName"].ToString();
                    PatientAdmissions.Add(c);
                }
                dr.Close();
                tran.Commit();


                return(PatientAdmissions);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #14
0
        public List <LabTest> GetLabTest()
        {
            List <LabTest> labTests = new List <LabTest>();

            try
            {
                string    select = "Select * from LabTest where IsMedicine=No";
                DataTable dt     = new DataTable();
                con                  = new OleDbConnection();
                readconfile          = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    da = new OleDbDataAdapter(select, con);
                    da.Fill(dt);
                }
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        LabTest labTest = new LabTest();
                        labTest.TestName   = Convert.ToString(row["Test (A-Z)"] == DBNull.Value ? "" : row["Test (A-Z)"]);
                        labTest.SampleName = Convert.ToString(row["Sample"] == DBNull.Value ? "" : row["Sample"]);
                        labTest.Performed  = Convert.ToString(row["Performed"] == DBNull.Value ? "" : row["Performed"]);
                        labTest.LabTestId  = Convert.ToInt32(row["ID"]);
                        labTest.Report     = Convert.ToString(row["Report"] == DBNull.Value ? "" : row["Report"]);
                        labTest.Deserving  = Convert.ToDecimal(row["Deserving"] == DBNull.Value ? 0 : row["Deserving"]);
                        labTest.Poor       = Convert.ToDecimal(row["Poor"] == DBNull.Value ? 0 : row["Poor"]);
                        labTest.YCDO       = Convert.ToDecimal(row["YCDO"] == DBNull.Value ? 0 : row["YCDO"]);
                        labTest.General    = Convert.ToDecimal(row["Generall"] == DBNull.Value ? 0 : row["Generall"]);
                        labTest.Shahab     = Convert.ToDecimal(row["Shahab"] == DBNull.Value ? 0 : row["Shahab"]);
                        labTest.Ghori      = Convert.ToDecimal(row["Ghori"] == DBNull.Value ? 0 : row["Ghori"]);
                        labTests.Add(labTest);
                    }
                }
                return(labTests);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #15
0
        public bool SavePatientToken(PatientRegistration pr)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();

                tran = con.BeginTransaction();
                int VID = 0;
                cmd             = new OleDbCommand("Select Max(tokennumber) From patientregistration where TokenMonthYear=" + pr.TokenMonthYear + "", con);
                cmd.Transaction = tran;

                if (DBNull.Value != (cmd.ExecuteScalar()))
                {
                    VID            = Convert.ToInt32(cmd.ExecuteScalar());
                    pr.TokenNumber = VID + 1;
                }
                else
                {
                    pr.TokenNumber = 1;
                }


                pr.Patient.RegistrationNumber = pr.TokenNumber + "" + pr.TokenMonthYear + "" + pr.Patient.RegistrationNumber;

                string insert = "Insert Into PatientRegistration(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName,PatientNIC"
                                + ",PatientAge,PatientMobile,PatientAddress,PatientType,TokenAmount,Room,PatientRegistrationNumber,PatientRegistrationDate,Shift,TokenBy,DrName) "
                                + "values ('" + pr.TokenDate.ToString("MM/dd/yyyy HH:mm:ss") + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','" + pr.Patient.NIC + "',"
                                + pr.Patient.Age + ",'" + pr.Patient.Mobile + "','" + pr.Patient.Address + "','" + pr.TokenType.ToString() + "'," + (int)pr.TokenType + ",'"
                                + pr.Room.Name + "','" + pr.Patient.RegistrationNumber + "','" + pr.Patient.RegistrationDate.ToString("MM/dd/yyyy") + "'," + new ShiftDAL().GetActiveShiftCode().ID + "," + pr.TokenBy.Userno + ",'" + pr.Room.LabelName + "' )";

                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            { con.Close(); }
        }
コード例 #16
0
        public List <Patient> GetPatientData()
        {
            Patient pr = new Patient();

            try
            {
                List <Patient> preg   = new List <Patient>();
                string         select = "select * from patientRegistration ";
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                cmd             = new OleDbCommand();
                cmd.CommandText = select;
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = con;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    pr                    = new Patient();
                    pr.FirstName          = dr["PatientFirstName"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientFirstName"]);
                    pr.LastName           = dr["PatientLastName"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientLastName"]);
                    pr.NIC                = dr["PatientNIC"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientNIC"]);
                    pr.Age                = (Int16)(dr["PatientAge"] == System.DBNull.Value ? 0 : Convert.ToInt16(dr["PatientAge"]));
                    pr.Mobile             = dr["PatientMobile"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientMobile"]);
                    pr.RegistrationDate   = dr["PatientRegistrationDate"] == System.DBNull.Value ? new DateTime() : Convert.ToDateTime(dr["PatientRegistrationDate"]);
                    pr.RegistrationNumber = dr["PatientRegistrationNumber"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientRegistrationNumber"]);
                    pr.Address            = dr["PatientAddress"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientAddress"]);
                    pr.PatientType        = dr["PatientType"] == System.DBNull.Value ? "" : Convert.ToString(dr["PatientType"]);
                    //pr.CashReceived =dr["TokenAmount"]==System.DBNull.Value?0: Convert.ToDouble(dr["TokenAmount"]);
                    //pr.TokenType = dr["TokenAmount"]==System.DBNull.Value? 0 : (TokenType)Convert.ToInt32(dr["TokenAmount"]);
                    //pr.Room.Name = dr["Room"] == System.DBNull.Value ? "" : Convert.ToString(dr["Room"]);
                    //pr.TokenDate = dr["TokenDate"] == System.DBNull.Value ? new DateTime() : Convert.ToDateTime(dr["TokenDate"]);
                    //pr.TokenMonthYear = dr["TokenMonthYear"] == System.DBNull.Value ? 0 : Convert.ToInt64(dr["TokenMonthYear"]);
                    //pr.TokenNumber = dr["TokenNumber"]==System.DBNull.Value?0: Convert.ToInt64(dr["TokenNumber"]);
                    preg.Add(pr);
                }
                dr.Close();
                return(preg);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { con.Close(); }
        }
コード例 #17
0
ファイル: DonorDAL.cs プロジェクト: ArishSultan/ycdo__old
        public bool SaveDonorData(Donor d)
        {
            try
            {
                string insert;
                if (d.MID == 0)

                    insert = "Insert Into Donor(DonorName,DonorLastName,Age,Gender,NIC"
                       + ",Refrence,Phone,Email,Bloodgroup,DonorFee,CollectionDate,Adress,BranchName,DonorNo,Status,FundType,City,CurrentDate) "
                       + "values ('" + d.DonorName + "','" + d.DonorLastName + "'," + d.AGE + ",'" + d.Gender + "','" + d.NIC + "','"
                       + d.Refrence + "'," + d.Phone + ",'" + d.Email + "','" + d.BloodGroup + "','"
                       + d.DonorFee + "',#" + d.CollectionDate + "#,'" + d.Adress + "','" + d.branch.BranchName + "',"
                       + "" + d.DonorNo + ",'" + d.Status + "','" + d.FundType + "','"+d.City.CityName+"',#"+d.CurrentDate+"# )";

                else

                    insert = "Update Donor set DonorName='" + d.DonorName + "',DonorLastName='" + d.DonorLastName + "',Age=" + d.AGE + ""
                        + ", Gender= '" + d.Gender + "',NIC= '" + d.NIC + "',Refrence='" + d.Refrence + "',Phone='" + d.Phone + "',Email='" + d.Email + "',"
                        + " Bloodgroup= '" + d.BloodGroup + "',DonorFee='" + d.DonorFee + "' ,CollectionDate= #" + d.CollectionDate + "#,Adress= '" + d.Adress + "',BranchName= '" + d.branch.BranchName + "',"
                + " DonorNo=" + d.DonorNo + " ,Status='" + d.Status + "' ,FundType= '" + d.FundType + "',City= '" + d.City.CityName + "',CurrentDate=#" + d.CurrentDate + "# where MID=" + d.MID + "";


                con = new OleDbConnection();
                this.readconfile = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran = con.BeginTransaction();
                cmd = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return true;
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                con.Close();
            }


        }
コード例 #18
0
        public List <User> GetUsers()
        {
            List <User> users;

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                this.dt = new DataTable();
                if (this.con.ConnectionString != "")
                {
                    this.con.Open();
                    this.cmd = new OleDbCommand();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.cmd.Connection  = this.con;
                        this.cmd.CommandText = "Select * from unames";
                        this.da = new OleDbDataAdapter(this.cmd.CommandText, this.con);
                        this.da.Fill(this.dt);
                        this.con.Close();
                    }
                }
                this.users = new List <User>();
                if (this.dt.Rows.Count > 0)
                {
                    foreach (DataRow row in this.dt.Rows)
                    {
                        this.user              = new User();
                        this.user.UserName     = Convert.ToString(row["UName"]);
                        this.user.UserPassword = Convert.ToString(row["Upwd"]);
                        this.user.IsAdmin      = Convert.ToBoolean(row["isadmin"]);
                        this.user.Userno       = Convert.ToInt32(row["UNo"]);
                        this.user.IsLogin      = Convert.ToBoolean(row["login"]);
                        this.users.Add(this.user);
                    }
                }
                users = this.users;
            }
            catch (Exception)
            {
                throw;
            }
            return(users);
        }
コード例 #19
0
        public bool DeleteSalesPerson(SalesPerson sp)
        {
            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                if (this.con.ConnectionString != "")
                {
                    this.con.Open();
                    this.cmd = new OleDbCommand();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.tran            = this.con.BeginTransaction();
                        this.cmd.Connection  = this.con;
                        this.cmd.Transaction = this.tran;

                        this.cmd.CommandType = CommandType.Text;

                        this.cmd.CommandText = "Delete * from HRBSalesAccounts  where SalesPersonID=" + sp.SPId;
                        this.cmd.ExecuteNonQuery();

                        this.cmd.CommandText = "Delete * from SalesPersons  where SalesPersonID=" + sp.SPId;

                        if (this.cmd.ExecuteNonQuery() == 0)
                        {
                            this.tran.Rollback();

                            return(false);
                        }



                        this.tran.Commit();
                        this.con.Close();
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #20
0
        public SocketListener(Func <byte[], byte[]> dataProcessor)
        {
            this.dataProcessor = dataProcessor;

            ServerSetting setting = ReadConfigFile.GetServerSetting();

            this.receivePrefixLength = setting.receivePrefixLength;
            this.bufferSize          = setting.bufferSize;
            this.supportKeepAlive    = setting.useKeepAlive;

            this.bufferManager           = new BufferManager(setting.bufferSize * setting.numberOfSaeaForRecSend * setting.opsToPreAllocate, setting.bufferSize * setting.opsToPreAllocate);
            this.poolOfAcceptEventArgs   = new SocketAsyncEventArgPool();
            this.poolOfRecSendEventArgs  = new SocketAsyncEventArgPool();
            this.maxConcurrentConnection = new Semaphore(setting.numberOfSaeaForRecSend, setting.numberOfSaeaForRecSend);

            Init(setting);
            StartListen(setting);
        }
コード例 #21
0
ファイル: DonorDAL.cs プロジェクト: ArishSultan/ycdo__old
             public List<DonorCollection> GetDonorCollectionData()
             {

                 try
                 {

                     Donorcollc = new List<DonorCollection>();
                     string insert = "Select * from DonorCollection";

                     con = new OleDbConnection();
                     this.readconfile = new ReadConfigFile();
                     con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                     con.Open();
                     tran = con.BeginTransaction();
                     cmd = new OleDbCommand(insert, con);
                     cmd.Transaction = tran;
                     dr = cmd.ExecuteReader();
                     while (dr.Read())
                     {
                         DonorCollection m = new DonorCollection();


                         m.ID = dr["ID"] == System.DBNull.Value ? 0 : Convert.ToInt32(dr["ID"]);
                         m.DonorName = dr["DonorName"] == System.DBNull.Value ? null : Convert.ToString(dr["DonorName"]);
                         m.CollectionDate = dr["CollectionDate"] == System.DBNull.Value ? new DateTime() : Convert.ToDateTime(dr["CollectionDate"]);
                         m.CollectionFee = dr["CollectionFee"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["CollectionFee"]);
                         m.ReciptNo = dr["ReciptNo"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["ReciptNo"]);
                         m.DonationType = dr["DonationType"] == System.DBNull.Value ? null : Convert.ToString(dr["DonationType"]);
                         m.Others = dr["Other"] == System.DBNull.Value ? null : Convert.ToString(dr["Other"]);
                         m.CheckDetail = dr["CheckDetail"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["CheckDetail"]);
                         Donorcollc.Add(m);

                     }
                     dr.Close();

                     tran.Commit();
                     return Donorcollc;
                 }
                 catch (Exception ex)
                 {

                     throw ex;
                 }
             }
コード例 #22
0
        public List <PatientRegistration> GetAllPatientNotChecked()
        {
            List <LabTest>             labTests = new List <LabTest>();
            List <PatientRegistration> prs      = new List <PatientRegistration>();

            try
            {
                string    select = "SELECT Distinct TokenDate,TokenMonthYear,TokenNumber from PatientRegistration where Checked=No ";
                DataTable dt     = new DataTable();
                con                  = new OleDbConnection();
                readconfile          = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    da = new OleDbDataAdapter(select, con);
                    da.Fill(dt);
                }

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        PatientRegistration pr = new PatientRegistration();

                        pr.TokenNumber    = Convert.ToInt64(row["TokenNumber"] == DBNull.Value ? 0 : row["TokenNumber"]);
                        pr.TokenMonthYear = Convert.ToInt64(row["TokenMonthYear"] == DBNull.Value ? 0 : row["TokenMonthYear"]);
                        pr.TokenDate      = Convert.ToDateTime(row["TokenDate"] == DBNull.Value ? DateTime.MinValue : row["TokenDate"]);

                        prs.Add(pr);
                    }
                }

                return(prs);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #23
0
        public bool SaveMembershipData(Membership mem)
        {
            try
            {
                string insert;
                if (mem.MID == 0)
                {
                    insert = "Insert Into MembershipData(MemberName,MemberLastName,Age,Gender,NIC"
                             + ",Refrence,Phone,Email,Bloodgroup,MemberShipFee,CollectionDate,Adress,BranchName,MembershipNo,Status,MonthlyFee,CurrentDate,City) "
                             + "values ('" + mem.MemberName + "','" + mem.MemberLastName + "'," + mem.AGE + ",'" + mem.Gender + "','" + mem.NIC + "','"
                             + mem.Refrence + "'," + mem.Phone + ",'" + mem.Email + "','" + mem.BloodGroup + "','"
                             + mem.MembershipFee + "'," + mem.CollectionDate + ",'" + mem.Adress + "','" + mem.branch.BranchName + "',"
                             + "" + mem.MembershipNo + ",'" + mem.Status + "'," + mem.MonthlyFee + ",#" + mem.CurrentDate + "#,'" + mem.City.CityName + "' )";
                }

                else
                {
                    insert = "Update MembershipData set MemberName='" + mem.MemberName + "',MemberLastName='" + mem.MemberLastName + "',Age=" + mem.AGE + ""
                             + ", Gender= '" + mem.Gender + "',NIC= '" + mem.NIC + "',Refrence='" + mem.Refrence + "',Phone='" + mem.Phone + "',Email='" + mem.Email + "',"
                             + " Bloodgroup= '" + mem.BloodGroup + "',MemberShipFee='" + mem.MembershipFee + "' ,CollectionDate= " + mem.CollectionDate + ",Adress= '" + mem.Adress + "',BranchName= '" + mem.branch.BranchName + "',"
                             + " MembershipNo=" + mem.MembershipNo + " ,Status='" + mem.Status + "' ,MonthlyFee= " + mem.MonthlyFee + ",CurrentDate=#" + mem.CurrentDate + "#,City='" + mem.City.CityName + "' where MID=" + mem.MID + "";
                }


                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #24
0
        public bool SaveMembershipCollection(MemberCollection mc)
        {
            try
            {
                if (new rtSMSDAL().SaveAndSendSMS(mc))
                {
                    string insert;
                    if (mc.ID == 0)
                    {
                        insert = "Insert Into MemberCollection(MemberName,CollectionDate,CollectionFee,ReciptNo,MID,CollectionMonth) "
                                 + "values ('" + mc.MemberName + "','" + mc.CollectionDate + "'," + mc.CollectionFee + "," + mc.ReciptNo + "," + mc.Member.MID + ",'" + mc.CollectionMonth + "')";
                    }

                    else
                    {
                        insert = "Update MemberCollection set MemberName='" + mc.MemberName + "',CollectionDate='" + mc.CollectionDate + "',CollectionFee=" + mc.CollectionFee + " ,ReciptNo=" + mc.ReciptNo + " , MID=" + mc.Member.MID + " , CollectionMonth='" + mc.CollectionMonth + "' where ID=" + mc.ID + "";
                    }


                    con = new OleDbConnection();
                    this.readconfile     = new ReadConfigFile();
                    con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                    con.Open();
                    tran            = con.BeginTransaction();
                    cmd             = new OleDbCommand(insert, con);
                    cmd.Transaction = tran;
                    cmd.ExecuteNonQuery();
                    tran.Commit();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #25
0
        public PatientRegistration GetPatientDetail(long tokenNumber)
        {
            PatientRegistration pr = new PatientRegistration();

            try
            {
                string select = "select * from patientregistration where TokenMonthYear=" + System.DateTime.Today.Month.ToString()
                                + System.DateTime.Today.Year.ToString() + " and TokenNumber=" + tokenNumber;
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                cmd             = new OleDbCommand();
                cmd.CommandText = select;
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = con;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    pr.Patient.FirstName          = (string)dr["PatientFirstName"];
                    pr.Patient.LastName           = (string)dr["PatientLastName"];
                    pr.Patient.NIC                = (string)dr["PatientNIC"];
                    pr.Patient.Age                = (Int16)dr["PatientAge"];
                    pr.Patient.Mobile             = (string)dr["PatientMobile"];
                    pr.Patient.RegistrationDate   = Convert.ToDateTime(dr["PatientRegistrationDate"]);
                    pr.Patient.RegistrationNumber = (string)dr["PatientRegistrationNumber"];
                    pr.Patient.Address            = (string)dr["PatientAddress"];
                    pr.CashReceived               = Convert.ToDouble(dr["TokenAmount"]);
                    pr.TokenType      = (TokenType)Convert.ToInt32(dr["TokenAmount"]);
                    pr.Room.Name      = (string)dr["Room"];
                    pr.TokenDate      = Convert.ToDateTime(dr["TokenDate"]);
                    pr.TokenMonthYear = Convert.ToInt64(dr["TokenMonthYear"]);
                    pr.TokenNumber    = Convert.ToInt64(dr["TokenNumber"]);
                }
                dr.Close();
                return(pr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { con.Close(); }
        }
コード例 #26
0
        public bool SaveReg(ProjectDetail prjdet)
        {
            bool flag;

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.MainConfigFile);
                if (this.con.ConnectionString != "")
                {
                    this.con.Open();
                    this.cmd = new OleDbCommand();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.tran            = this.con.BeginTransaction();
                        this.cmd.Connection  = this.con;
                        this.cmd.Transaction = this.tran;
                        this.cmd.CommandText = "Update Enhancements Set EnhActivationCode='" + prjdet.Active_code + "'where EnhCode='" + prjdet.ProjectName + "' ";
                        this.cmd.CommandType = CommandType.Text;
                        if (this.cmd.ExecuteNonQuery() == 0)
                        {
                            this.tran.Rollback();
                            this.con.Close();
                            return(false);
                        }
                        this.tran.Commit();
                        this.con.Close();
                        return(true);
                    }
                }
                flag = false;
            }
            catch (Exception)
            {
                if (this.con.State != ConnectionState.Closed)
                {
                    this.con.Close();
                }
                throw;
            }
            return(flag);
        }
コード例 #27
0
ファイル: MedicinesDAL.cs プロジェクト: ArishSultan/ycdo__old
        public DSMedicineStatus GetData(LabTest lt, bool all)
        {
            DSMedicineStatus ds = new DSMedicineStatus();

            try
            {
                string select = string.Empty;
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (all == true)
                {
                    select = "select * from (select ID, IssueDate as TransactionDate, IssueNumber as Refrence ,MedicineId,MedicineName,Qty as IssueQty,0 as ReceiveQty, GrossAmount, Netamount,BranchName from IssuedMedicine "
                             + "Union All"
                             + " select ID, RecieveDate as TransactionDate, RecievedNumber as Refrence,ItemNumber as MedicineId,ItemName as MedicineName,0 as IssueQty,Qty as ReceiveQty,GrossAmount, NetAmount,'' as BranchName from ReceiveMedicine) temp order by transactiondate ";
                }
                else
                {
                    select = "select * from (select ID, IssueDate as TransactionDate, IssueNumber as Refrence ,MedicineId,MedicineName,Qty as IssueQty,0 as ReceiveQty, GrossAmount, Netamount,BranchName from IssuedMedicine "
                             + "Union All"
                             + " select ID, RecieveDate as TransactionDate, RecievedNumber as Refrence,ItemNumber as MedicineId,ItemName as MedicineName,0 as IssueQty,Qty as ReceiveQty,GrossAmount, NetAmount,'' as BranchName from ReceiveMedicine) temp where MedicineId=" + lt.LabTestId + " order by transactiondate ";
                }

                if (con.State == ConnectionState.Open)
                {
                    da = new OleDbDataAdapter(select, con);
                    da.Fill(ds, ds.Tables[0].TableName);
                }


                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
コード例 #28
0
        public bool EditUser(User user)
        {
            bool flag;

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                if (this.con.ConnectionString != "")
                {
                    this.cmd = new OleDbCommand();
                    if (!this.HasMoreThan1Admin(user))
                    {
                        throw new Exception("At Least One Administrator must exist.");
                    }
                    this.con.Open();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.tran            = this.con.BeginTransaction();
                        this.cmd.Connection  = this.con;
                        this.cmd.Transaction = this.tran;
                        this.cmd.CommandType = CommandType.Text;
                        this.cmd.CommandText = string.Concat(new object[] { "Update unames set uname='", user.UserName, "',upwd='", Common.DataBasePassword.Encrypt(user.UserPassword), "',isadmin='", user.IsAdmin, "' where uno=", user.Userno });
                        if (this.cmd.ExecuteNonQuery() == 0)
                        {
                            this.tran.Rollback();
                            return(false);
                        }
                        this.tran.Commit();
                        this.con.Close();
                        return(true);
                    }
                }
                flag = false;
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
コード例 #29
0
 public bool SaveRecieveMedicine(RecieveMedicine rm)
 {
     try
     {
         int VID = 0;
         con = new OleDbConnection();
         this.readconfile     = new ReadConfigFile();
         con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
         con.Open();
         tran = con.BeginTransaction();
         cmd  = new OleDbCommand("", con);
         //cmd.Connection = con;
         cmd.Transaction = tran;
         //cmd.CommandType = CommandType.Text;
         cmd.CommandText = "delete from ReceiveMedicine where RecievedNumber=" + rm.RecieveNumber;
         cmd.ExecuteNonQuery();
         OleDbCommand cmdSave = new OleDbCommand();
         cmdSave.Connection  = con;
         cmdSave.Transaction = tran;
         foreach (RecieveLineItem item in rm.Lines)
         {
             //if (rm.RefRec.LineItem.MedIssuedID == 0)
             //{
             if (item.LineItem.LabTestId > 0)
             {
                 cmdSave.CommandText = "Insert into ReceiveMedicine(RecieveDate,RecievedNumber,ItemNumber,ItemName,Qty,Price,GrossAmount,NetAmount) values (#" +
                                       rm.RecieveDate + "#," + rm.RecieveNumber + "," + item.LineItem.LabTestId + ",'" +
                                       item.LineItem.TestName + "'," + item.Quantity + "," + item.Price + "," + item.GrossAmount + "," + rm.RefRec.NetAmount + ")";
             }
             cmdSave.ExecuteNonQuery();
         }
         tran.Commit();
     }
     catch (Exception ex)
     {
         tran.Rollback();
         throw ex;
     }
     finally
     { con.Close(); }
     return(true);
 }
コード例 #30
0
        public bool VerifyDBUser()
        {
            bool   flag;
            string str = "";

            try
            {
                this.readconfile          = new ReadConfigFile();
                this.projectdetail        = new ProjectDetail();
                this.con                  = new OleDbConnection();
                this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.MainConfigFile);
                if (this.con.ConnectionString != "")
                {
                    this.con.Open();
                    this.cmd = new OleDbCommand();
                    if (this.con.State == ConnectionState.Open)
                    {
                        this.cmd.Connection  = this.con;
                        this.cmd.CommandText = "Select EnhActivationCode from Enhancements where EnhCode='" + this.projectdetail.ProjectName + "'";
                        this.cmd.CommandType = CommandType.Text;
                        str = Convert.ToString(this.cmd.ExecuteScalar());
                        this.con.Close();
                        if ((str != "") && (str != "none"))
                        {
                            return(true);
                        }
                    }
                }
                flag = false;
            }
            catch (Exception)
            {
                if (this.con.State != ConnectionState.Closed)
                {
                    this.con.Close();
                }
                throw;
            }
            return(flag);
        }