コード例 #1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         clsEntAgencyDetails objEnt = new clsEntAgencyDetails();
         objAgency = new clsAgencyDetails();
         if (agencyID == null)
         {
             objEnt = objAgency.readAgencyDetails(0, txtAgencyName.Text);
             string ageID = objEnt.AgencyID.ToString();
             this.funcUpdate(ageID);
         }
         else
         {
             this.funcUpdate(agencyID);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex);
     }
 }
コード例 #2
0
        private void fillAllInfo(string agencyID, string agencyName)
        {
            clsEntAgencyDetails objEnt = new clsEntAgencyDetails();

            objAgency = new clsAgencyDetails();
            if (agencyID != null)
            {
                objEnt = objAgency.readAgencyDetails(Convert.ToInt32(agencyID), null);
                if (objEnt.AgencyName != null)
                {
                    lblMessage.Text        = "Information Available in Database";
                    txtAgencyCode.Text     = objEnt.AgencyCode;
                    txtAgencyName.Text     = objEnt.AgencyName;
                    txtPostalCode.Text     = objEnt.PostalCode;
                    drpState.SelectedValue = objEnt.State;
                    txtTelephone.Text      = objEnt.Telephone;
                    txtCellPhone.Text      = objEnt.Cellphone;
                    txtFax.Text            = objEnt.Fax;
                    txtEmail.Text          = objEnt.Email;
                    txtSkypeID.Text        = objEnt.SkypeID;
                    txtAddress.Text        = objEnt.Address;

                    if (objEnt.chkILM)
                    {
                        chkLineMinistry.Text = "Yes";
                    }
                    else
                    {
                        chkLineMinistry.Text = "No";
                    }

                    chkLineMinistry.Checked = objEnt.chkILM;
                    //start Date
                    if (objEnt.StartDate.ToString() == "" || objEnt.EndDate.ToString() == "01-01-1900" || objEnt.EndDate.ToString() == "01-01-0001")
                    {
                        txtStartDate.Text = "";
                    }
                    else
                    {
                        DateTime dtStartDate = DateTime.Parse(objEnt.StartDate.ToString());
                        txtStartDate.Text = dtStartDate.ToString("dd MMM yyyy");
                    }
                    //End Date
                    if (objEnt.EndDate.ToString() == "" || objEnt.EndDate.ToString() == "01-01-1900" || objEnt.EndDate.ToString() == "01-01-0001")
                    {
                        txtEndDate.Text = "";
                    }
                    else
                    {
                        DateTime dtEndDate = DateTime.Parse(objEnt.StartDate.ToString());
                        txtEndDate.Text = dtEndDate.ToString("dd MMM yyyy");
                    }

                    txtLineMinistryAgency.Text = objEnt.LineMinistryName;
                    if (ddlsts.Items.FindByText(objEnt.eapsts) != null)
                    {
                        ddlsts.Items.FindByText(objEnt.eapsts).Selected = true;
                    }
                }
                else
                {
                    lblMessage.Text = string.Empty;
                }
            }

            if (agencyName != "")
            {
                objEnt = objAgency.readAgencyDetails(0, txtAgencyName.Text);

                if (objEnt.AgencyName != null)
                {
                    agencyID               = objEnt.AgencyID.ToString();
                    txtAgencyCode.Text     = objEnt.AgencyCode;
                    txtAgencyName.Text     = objEnt.AgencyName;
                    txtPostalCode.Text     = objEnt.PostalCode;
                    drpState.SelectedValue = objEnt.State;
                    txtTelephone.Text      = objEnt.Telephone;
                    txtCellPhone.Text      = objEnt.Cellphone;
                    txtFax.Text            = objEnt.Fax;
                    txtEmail.Text          = objEnt.Email;
                    txtSkypeID.Text        = objEnt.SkypeID;
                    txtAddress.Text        = objEnt.Address;

                    //start Date
                    if (objEnt.StartDate.ToString() == "" || objEnt.EndDate.ToString() == "01-01-1900" || objEnt.EndDate.ToString() == "01-01-0001")
                    {
                        txtStartDate.Text = "";
                    }
                    else
                    {
                        DateTime dtStartDate = DateTime.Parse(objEnt.StartDate.ToString());
                        txtStartDate.Text = dtStartDate.ToString("dd MMM yyyy");
                    }
                    //End Date
                    if (objEnt.EndDate.ToString() == "" || objEnt.EndDate.ToString() == "01-01-1900" || objEnt.EndDate.ToString() == "01-01-0001")
                    {
                        txtEndDate.Text = "";
                    }
                    else
                    {
                        DateTime dtEndDate = DateTime.Parse(objEnt.StartDate.ToString());
                        txtEndDate.Text = dtEndDate.ToString("dd MMM yyyy");
                    }
                    txtLineMinistryAgency.Text = objEnt.LineMinistryName;
                    if (ddlsts.Items.FindByText(objEnt.eapsts) != null)
                    {
                        ddlsts.Items.FindByText(objEnt.eapsts).Selected = true;
                    }

                    btnSave.Visible   = false;
                    btnUpdate.Visible = true;
                }
                else
                {
                    btnSave.Visible   = true;
                    btnUpdate.Visible = false;
                    lblMessage.Text   = string.Empty;
                }
            }
        }
コード例 #3
0
    public clsEntAgencyDetails readAgencyDetails(int ID, string agencyName)
    {
        objEnt = new clsEntAgencyDetails();

        SqlDataReader objRead;

        objAccess = new SqlDataAccess(clsConstant.DBCONSTRING);

        try
        {
            if (objAccess.Connection.State == ConnectionState.Closed)
            {
                objAccess.Connection.Open();
            }

            if (ID != 0)
            {
                SqlParameter[] pram = new SqlParameter[] { new SqlParameter("@agencyID", ID) };
                objRead = objAccess.ExecuteReaderQuery(clsConstant.SP_SELECT_AGENCY_DETAILS, CommandType.StoredProcedure, pram);
            }
            else
            {
                SqlParameter[] pram = new SqlParameter[] { new SqlParameter("@name", agencyName) };
                objRead = objAccess.ExecuteReaderQuery(clsConstant.SP_SELECT_AGENCY_DETAILS, CommandType.StoredProcedure, pram);
            }

            while (objRead.Read())
            {
                objEnt.AgencyID   = int.Parse(objRead.GetValue(0).ToString());
                objEnt.AgencyCode = objRead.GetValue(1).ToString();
                objEnt.AgencyName = objRead.GetValue(2).ToString();
                objEnt.Address    = objRead.GetValue(3).ToString();
                objEnt.PostalCode = objRead.GetValue(4).ToString();
                //if (ID != 0)
                //{
                objEnt.State = objRead.GetValue(5).ToString();
                //}
                //else
                //    objEnt.State = objRead.GetValue(6).ToString();
                objEnt.Telephone = objRead.GetValue(7).ToString();
                objEnt.Cellphone = objRead.GetValue(8).ToString();
                objEnt.Fax       = objRead.GetValue(9).ToString();
                objEnt.Email     = objRead.GetValue(10).ToString();
                objEnt.SkypeID   = objRead.GetValue(11).ToString();
                string strDate = objRead.GetValue(12).ToString();

                if (strDate == "" || strDate == "01-01-0001")
                {
                    objEnt.StartDate = "";
                }
                else
                {
                    objEnt.StartDate = strDate;
                }
                string endDate = objRead.GetValue(13).ToString();
                if (endDate == "" || endDate == "01-01-0001")
                {
                    objEnt.EndDate = "";
                }
                else
                {
                    objEnt.EndDate = endDate;
                }

                string isChkLm = objRead.GetValue(14).ToString();

                if (isChkLm == "")
                {
                    objEnt.chkILM = false;
                }
                else
                {
                    objEnt.chkILM = bool.Parse(objRead.GetValue(14).ToString());
                }

                objEnt.LineMinistryName = objRead.GetValue(15).ToString();
                objEnt.eapsts           = objRead.GetValue(16).ToString();
            }
            objRead.Close();
            return(objEnt);
        }
        catch (Exception exMessage)
        {
            throw exMessage;
        }
    }