public List <clsTransferHistory> GetAllTransferHistoryList(clsDocumentFilter clsdoc)
        {
            List <clsTransferHistory> lst = new List <clsTransferHistory>();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("TMR_USP_GetAllTransferHistory"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = conn;

                    cmd.Parameters.AddWithValue("@RegistrationNo", clsdoc.strRegistrationNo);
                    // cmd.Parameters.AddWithValue("@ProjectID", clsdoc.strProjectID);
                    cmd.Parameters.AddWithValue("@TransferFromID", clsdoc.strClientID);
                    cmd.Parameters.AddWithValue("@TransferToID", clsdoc.strToClientID);
                    cmd.Parameters.AddWithValue("@StartDate", clsdoc.dateStartDate);
                    cmd.Parameters.AddWithValue("@EndDate", clsdoc.dateEndDate);
                    cmd.Parameters.AddWithValue("@ApprovalStatusCode", clsdoc.intApprovalStatusCode);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        var info = new clsTransferHistory();

                        info.intID                     = Convert.ToInt32(reader["ID"].ToString());
                        info.strRegistrationNo         = reader["RegistrationNo"].ToString();
                        info.strTransferFromID         = reader["TransferFromID"].ToString();
                        info.strTransferToID           = reader["TransferToID"].ToString();
                        info.dtTransferDate            = Convert.ToDateTime(reader["TransferDate"]);
                        info.ApprovalStatusCode        = Convert.ToInt32(reader["ApprovalStatusCode"].ToString());
                        info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString();
                        info.ApprovalActionUser        = reader["ApprovalActionUser"].ToString();
                        info.ApprovalStatusCode        = Convert.ToInt32(reader["ApprovalStatusCode"].ToString());
                        info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString();
                        info.ApprovalActionUser        = reader["ApprovalActionUser"].ToString();
                        info.ApprovalActionDate        = Convert.ToDateTime(reader["ApprovalActionDate"]);
                        info.CreatedBy                 = reader["CreatedBy"].ToString();
                        info.CreationDate              = Convert.ToDateTime(reader["CreationDate"].ToString());
                        info.LastUpdateUser            = reader["LastUpdateUser"].ToString();
                        info.LastUpdateDate            = Convert.ToDateTime(reader["LastUpdateDate"]);
                        info.strName                   = reader["Name"].ToString();
                        info.strFatherOrHusbandType    = reader["FatherOrHusbandType"].ToString();
                        info.strFatherOrHusband        = reader["FatherOrHusbandName"].ToString();
                        info.strNIDOrCNIC              = reader["CNIC"].ToString();
                        info.strNationality            = reader["Nationality"].ToString();
                        info.dtDOB                     = Convert.ToDateTime(reader["DOB"].ToString());
                        info.strCurrentAddress1        = reader["CurrentAddress1"].ToString();
                        info.strCurrentAddress2        = reader["CurrentAddress2"].ToString();
                        info.strCurrentAddress3        = reader["CurrentAddress3"].ToString();
                        info.strCountry                = reader["Country"].ToString();
                        info.strCity                   = reader["City"].ToString();
                        info.strPhOff                  = reader["PhOff"].ToString();
                        info.strRes                    = reader["Res"].ToString();
                        info.strMob                    = reader["Mob"].ToString();

                        info.strEmailAddress = reader["EmailAddress"].ToString();



                        lst.Add(info);
                    }
                    conn.Close();
                }
            }
            return(lst);
        }
        public clsTransferHistory GetTransferHistoryById(int id)
        {
            clsTransferHistory info = new clsTransferHistory();

            try
            {
                using (SqlConnection conn = new SqlConnection(strConn))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand("TMR_USP_GetTransferHistoryByID"))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Connection  = conn;
                        cmd.Parameters.AddWithValue("@ID", id);

                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.HasRows == false)
                        {
                            info = null;
                        }

                        while (reader.Read())
                        {
                            info = new clsTransferHistory();

                            info.intID             = Convert.ToInt32(reader["ID"].ToString());
                            info.strRegistrationNo = reader["RegistrationNo"].ToString();
                            info.strTransferFromID = reader["TransferFromID"].ToString();
                            info.strTransferToID   = reader["TransferToID"].ToString();
                            info.dtTransferDate    = Convert.ToDateTime(reader["TransferDate"]);


                            info.strName = reader["Name"].ToString();
                            info.strFatherOrHusbandType = reader["FatherOrHusbandType"].ToString();
                            info.strFatherOrHusband     = reader["FatherOrHusbandName"].ToString();
                            info.strNIDOrCNIC           = reader["CNIC"].ToString();
                            info.strNationality         = reader["Nationality"].ToString();
                            info.dtDOB = Convert.ToDateTime(reader["DOB"].ToString());
                            info.strCurrentAddress1 = reader["CurrentAddress1"].ToString();
                            info.strCurrentAddress2 = reader["CurrentAddress2"].ToString();
                            info.strCurrentAddress3 = reader["CurrentAddress3"].ToString();
                            info.strCountry         = reader["Country"].ToString();
                            info.strCity            = reader["City"].ToString();
                            info.strPhOff           = reader["PhOff"].ToString();
                            info.strRes             = reader["Res"].ToString();
                            info.strMob             = reader["Mob"].ToString();
                            //info.strFax = reader["Fax"].ToString();
                            info.strEmailAddress = reader["EmailAddress"].ToString();

                            info.ApprovalStatusCode        = Convert.ToInt32(reader["ApprovalStatusCode"].ToString());
                            info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString();
                            info.ApprovalActionUser        = reader["ApprovalActionUser"].ToString();
                            info.ApprovalStatusCode        = Convert.ToInt32(reader["ApprovalStatusCode"].ToString());
                            info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString();
                            info.ApprovalActionUser        = reader["ApprovalActionUser"].ToString();
                            info.ApprovalActionDate        = Convert.ToDateTime(reader["ApprovalActionDate"]);
                            info.CreatedBy      = reader["CreatedBy"].ToString();
                            info.CreationDate   = Convert.ToDateTime(reader["CreationDate"].ToString());
                            info.LastUpdateUser = reader["LastUpdateUser"].ToString();
                            info.LastUpdateDate = Convert.ToDateTime(reader["LastUpdateDate"]);
                        }
                        conn.Close();
                    }
                }
            }
            catch (Exception exc)
            {
                info = null;
            }
            finally { }
            return(info);
        }
Пример #3
0
        private void SaveTransfer(ApprovalStatus approvalStatus)
        {
            if (EntryApproved != ApprovalStatus.Pending)
            {
                MessageBox.Show("This entry has already been Approved/Rejected");
                return;
            }

            if (id == 0 && approvalStatus != ApprovalStatus.Pending)
            {
                MessageBox.Show("This entry needs to be saved first before approval process.");
                return;
            }
            bool result;

            var info1 = new clsTransferHistory();

            info1.intID                  = this.id;
            info1.strRegistrationNo      = txtRegistration.Text.Trim();
            info1.strTransferFromID      = txtClientID.Text;
            info1.strTransferToID        = txtTransferID.Text;
            info1.dtTransferDate         = dtptransferDate.Value;
            info1.strName                = txtTransferName.Text;
            info1.strFatherOrHusbandType = cmbTransferFatherHusband.Text;
            info1.strFatherOrHusband     = txtTransferFatherHusband.Text;
            info1.strNIDOrCNIC           = txtNIDCNIC.Text;
            info1.strNationality         = cmbTransferNationality.Text;
            info1.dtDOB                  = dTPTransferDOB.Value;
            info1.strCurrentAddress1     = txtTransferCurrentAddress1.Text.Trim();
            info1.strCurrentAddress2     = txtTransferCurrentAddress2.Text.Trim();
            info1.strCurrentAddress3     = txtTransferCurrentAddress3.Text.Trim();
            info1.strCountry             = cmbTransferCountry.Text;
            info1.strCity                = txtTransferCity.Text;
            info1.strPhOff               = txtTransferPh.Text;
            info1.strRes                 = txtTransferRes.Text;
            info1.strMob                 = txtTransferMob.Text;
            info1.strFax                 = "";
            info1.strEmailAddress        = txtTransferEmailAddress.Text;


            /////////////


            if (id == 0)
            {
                info1.CreatedBy          = Dynamics.Globals.UserId;
                info1.CreationDate       = DateTime.Now;
                info1.ApprovalStatusCode = (int)ApprovalStatus.Pending;
                info1.LastUpdateDate     = new DateTime(1900, 1, 1);
                info1.LastUpdateUser     = "";
                info1.ApprovalActionUser = "";
                info1.ApprovalActionDate = new DateTime(1900, 1, 1);

                info1.intPreviousStatusCode = infoMember.intStatusCode;
            }
            else if (id != 0)
            {
                info1.CreatedBy    = Dynamics.Globals.UserId;
                info1.CreationDate = DateTime.Now;

                info1.LastUpdateDate = DateTime.Now;
                info1.LastUpdateUser = Dynamics.Globals.UserId;

                info1.ApprovalStatusCode = (int)approvalStatus;

                if (approvalStatus != ApprovalStatus.Pending)
                {
                    info1.ApprovalActionUser = Dynamics.Globals.UserId;
                    info1.ApprovalActionDate = DateTime.Now;
                }
                else
                {
                    info1.ApprovalActionUser = "";
                    info1.ApprovalActionDate = new DateTime(1900, 1, 1);
                }
            }



            int intTransID = 0;

            result = da.AddTransferHistory(info1, ref intTransID);

            if (result == false)
            {
                MessageBox.Show("An Error Occoured");
                return;
            }

            infoMember.RegistrationNo = txtRegistration.Text;
            infoMember.ClientID       = txtClientID.Text;


            infoMember.ClientID = txtTransferID.Text;

            infoMember.RegistrationNo = txtRegistration.Text.Trim();
            infoMember.ClientID       = txtTransferID.Text;

            infoMember.Name = txtTransferName.Text;
            infoMember.FatherOrHusbandType = cmbTransferFatherHusband.Text;
            infoMember.FatherOrHusband     = txtTransferFatherHusband.Text;
            infoMember.NIDOrCNIC           = txtNIDCNIC.Text;
            infoMember.Nationality         = cmbTransferNationality.Text;
            infoMember.DOB             = dTPTransferDOB.Value;
            infoMember.CurrentAddress1 = txtTransferCurrentAddress1.Text.Trim();
            infoMember.CurrentAddress2 = txtTransferCurrentAddress2.Text.Trim();
            infoMember.CurrentAddress3 = txtTransferCurrentAddress3.Text.Trim();
            infoMember.Country         = cmbTransferCountry.Text;
            infoMember.City            = txtTransferCity.Text;
            infoMember.PhOff           = txtTransferPh.Text;
            infoMember.Res             = txtTransferRes.Text;
            infoMember.Mob             = txtTransferMob.Text;
            infoMember.Fax             = "";
            infoMember.EmailAddress    = txtTransferEmailAddress.Text;


            if (approvalStatus == ApprovalStatus.Approved)
            {
                infoMember.intStatusCode = (int)memberLookupCodes.Transferred;
            }
            else if (approvalStatus == ApprovalStatus.Pending)
            {
                infoMember.intStatusCode = (int)memberLookupCodes.MarkedForTransfer;
            }
            result = da.UpdateRegistrationonTransfer(infoMember, txtClientID.Text);
            if (result == false)
            {
                MessageBox.Show("An Error Occured");
                return;
            }

            if ((approvalStatus == ApprovalStatus.Pending))
            {
                if (pbTransferToImage.Image == null)
                {
                    return;
                }
                clsTransferImage memberImage = new clsTransferImage()
                {
                    TransferID     = intTransID,
                    ClientID       = txtTransferID.Text,
                    ImageId        = txtPictureName.Text,
                    RegistrationNo = txtRegistration.Text
                };
                memberImage.Image = imageToByteArray(this.pbTransferToImage.Image);

                da.AddTransferImage(memberImage);

                if (pbTransferToCNIC.Image == null)
                {
                    return;
                }
                clsTransferCNIC memberCNIC = new clsTransferCNIC()
                {
                    TransferID     = intTransID,
                    ClientID       = txtTransferID.Text,
                    ImageId        = txtCNICName.Text,
                    RegistrationNo = txtRegistration.Text
                };
                memberCNIC.Image = imageToByteArray(this.pbTransferToCNIC.Image);

                da.AddTransferCNIC(memberCNIC);
            }
            else if ((approvalStatus == ApprovalStatus.Approved))
            {
                da.AddMemberImageonTransfer(intTransID);
                da.AddMemberCNIConTransfer(intTransID);
            }


            Clear();
        }
        public bool AddTransferHistory(clsTransferHistory info, ref int id)
        {
            int st = 0;

            try
            {
                using (SqlConnection conn = new SqlConnection(strConn))
                {
                    conn.Open();

                    {
                        using (SqlCommand cmd = new SqlCommand("TMR_USP_AddTransferHistory"))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Connection  = conn;

                            cmd.Parameters.AddWithValue("@RegistrationNo", info.strRegistrationNo);
                            cmd.Parameters.AddWithValue("@TransferFromID", info.strTransferFromID);
                            cmd.Parameters.AddWithValue("@TransferToID", info.strTransferToID);
                            cmd.Parameters.AddWithValue("@TransferDate", info.dtTransferDate);
                            cmd.Parameters.AddWithValue("@Name", info.strName);
                            cmd.Parameters.AddWithValue("@FatherOrHusbandType", info.strFatherOrHusbandType);
                            cmd.Parameters.AddWithValue("@FatherOrHusbandName", info.strFatherOrHusband);
                            cmd.Parameters.AddWithValue("@CNIC", info.strNIDOrCNIC);
                            cmd.Parameters.AddWithValue("@Nationality", info.strNationality);
                            cmd.Parameters.AddWithValue("@DOB", info.dtDOB);
                            cmd.Parameters.AddWithValue("@CurrentAddress1", info.strCurrentAddress1);
                            cmd.Parameters.AddWithValue("@CurrentAddress2", info.strCurrentAddress2);
                            cmd.Parameters.AddWithValue("@CurrentAddress3", info.strCurrentAddress3);
                            cmd.Parameters.AddWithValue("@Country", info.strCountry);
                            cmd.Parameters.AddWithValue("@City", info.strCity);
                            cmd.Parameters.AddWithValue("@PhOff", info.strPhOff);
                            cmd.Parameters.AddWithValue("@Res", info.strRes);
                            cmd.Parameters.AddWithValue("@Mob", info.strMob);
                            cmd.Parameters.AddWithValue("@EmailAddress", info.strEmailAddress);
                            cmd.Parameters.AddWithValue("@ApprovalStatusCode", info.ApprovalStatusCode);
                            cmd.Parameters.AddWithValue("@ApprovalActionUser", info.ApprovalActionUser);
                            cmd.Parameters.AddWithValue("@ApprovalActionDate", info.ApprovalActionDate);
                            cmd.Parameters.AddWithValue("@CreatedBy", info.CreatedBy);
                            cmd.Parameters.AddWithValue("@CreationDate", info.CreationDate);
                            cmd.Parameters.AddWithValue("@LastUpdateUser", info.LastUpdateUser);
                            cmd.Parameters.AddWithValue("@LastUpdateDate", info.LastUpdateDate);
                            cmd.Parameters.AddWithValue("@ID", info.intID);

                            SqlParameter parm = new SqlParameter();
                            parm.ParameterName = "@Outid";
                            parm.SqlDbType     = SqlDbType.Int;
                            parm.Direction     = ParameterDirection.Output;
                            //parm.Value = info.id;

                            cmd.Parameters.Add(parm);
                            st = cmd.ExecuteNonQuery();

                            id = (int)parm.Value;
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex) { }
            if (st > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        private void frmTransfer_Load(object sender, EventArgs e)
        {
            clsTransferHistory clsTrn = new clsTransferHistory();

            cmbApprovalStatus.Text = "Not Saved";
            if (id != 0)
            {
                bEdit  = true;
                clsTrn = da.GetTransferHistoryById(id);

                //Transfer From
                var v = da.GetMemberRegistrationInfoByMembershipAndCNIC(clsTrn.strRegistrationNo, clsTrn.strTransferFromID);
                /////Disabling
                btnSelect.Enabled       = false;
                txtClientID.Text        = v.ClientID;
                txtName.Text            = v.Name;
                cBFatherHusband.Text    = v.FatherOrHusbandType;
                txtFatherHusband.Text   = v.FatherOrHusband;
                txtNIDCNIC.Text         = v.NIDOrCNIC;
                cmbNationality.Text     = v.Nationality;
                dTPDOB.Value            = v.DOB;
                txtCurrentAddress1.Text = v.CurrentAddress1;
                txtCurrentAddress2.Text = v.CurrentAddress2;
                txtCurrentAddress3.Text = v.CurrentAddress3;
                cmbCountry.Text         = v.Country.ToString().ToUpper();
                txtCity.Text            = v.City.ToString().ToUpper();
                txtPh.Text           = v.PhOff;
                txtRes.Text          = v.Res;
                txtMob.Text          = v.Mob;
                txtFax.Text          = v.Fax;
                txtEmailAddress.Text = v.EmailAddress;


                // Transfer TO
                txtTransferID.Text              = clsTrn.strTransferToID;
                txtTransferName.Text            = clsTrn.strName;
                cmbTransferFatherHusband.Text   = clsTrn.strFatherOrHusbandType;
                txtTransferFatherHusband.Text   = clsTrn.strFatherOrHusband;
                cmbTransferNationality.Text     = clsTrn.strNationality;
                dTPTransferDOB.Value            = clsTrn.dtDOB;
                txtTransferCurrentAddress1.Text = clsTrn.strCurrentAddress1;
                txtTransferCurrentAddress2.Text = clsTrn.strCurrentAddress2;
                txtTransferCurrentAddress3.Text = clsTrn.strCurrentAddress3;
                cmbTransferCountry.Text         = clsTrn.strCountry.ToString().ToUpper();
                txtTransferCity.Text            = clsTrn.strCity.ToString().ToUpper();
                txtTransferPh.Text              = clsTrn.strPhOff;
                txtTransferRes.Text             = clsTrn.strRes;
                txtTransferMob.Text             = clsTrn.strMob;
                txtTransferEmailAddress.Text    = clsTrn.strEmailAddress;
                txtRegistration.Text            = clsTrn.strRegistrationNo;

                EntryApproved = (ApprovalStatus)clsTrn.ApprovalStatusCode;
                if ((ApprovalStatus)clsTrn.ApprovalStatusCode == ApprovalStatus.Pending)
                {
                    cmbApprovalStatus.Text = "Pending";
                }
                else if ((ApprovalStatus)clsTrn.ApprovalStatusCode == ApprovalStatus.Approved)
                {
                    cmbApprovalStatus.Text = "Approved";
                }
                else if ((ApprovalStatus)clsTrn.ApprovalStatusCode == ApprovalStatus.Rejected)
                {
                    cmbApprovalStatus.Text = "Rejected";
                }

                txtBlock.Text   = v.Block;
                txtPlot.Text    = v.Plot;
                txtProject.Text = v.strProjectid;
                txtUnitID.Text  = v.Plot;



                LoadTransferImage();
                LoadMemberImage();
            }
        }