コード例 #1
0
        /// <summary>
        /// This method defines the behavior of the Submit button for the create
        /// intervention page. Once the values are inserted in the form and the user
        /// selects the submit button all the data is collected and a new intervention
        /// is created. If the labor and cost fields are empty then the default cost and
        /// value for the intervention is collected from the database using the Data Operator
        /// from the Data Layer folder. Once all the fields are validated, a new core info record
        /// is created, the user is then redirected to the client detail page with the listing
        /// of all interventions related to that client and the newly created intervention.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            // Todo: Style of date input;
            // Todo: Style of button;
            int getLabour  = 0;
            int getCost    = 0;
            int getIntType = int.Parse(ddInt.SelectedValue);
            int getCID     = int.Parse(hfClientID.Value);

            if (txtLabour.Text == "" || txtCost.Text == "")
            {
                DataLayer.DataOperator         intType    = new DataLayer.DataOperator();
                IMS.DataLayer.interventionType intTypeRow = intType.GetIntTypeByID(getIntType);
                getLabour = int.Parse(intTypeRow.amount_of_labour);
                getCost   = int.Parse(intTypeRow.cost_of_materials);
            }
            else
            {
                getLabour = int.Parse(txtLabour.Text);
                getCost   = int.Parse(txtCost.Text);
            }
            DataLayer.DataOperator dataUserInfo = new DataLayer.DataOperator();
            string UID = User.Identity.GetUserId().ToString();

            IMS.DataLayer.view_user user = dataUserInfo.GetUserByID(UID);
            int UserID = user.users_ID;

            DataLayer.DataOperator obj = new DataLayer.DataOperator();
            obj.CreateCoreInfo(getIntType, getCID, getLabour, getCost, UserID, DateTime.Parse(txtDate.Text), "Proposed", "", 0, DateTime.Now);
            Response.Redirect("eng_detail_client?cid=" + getCID);
        }
コード例 #2
0
        /// <summary>
        /// Once the approve button is selected the CoreID property is used,
        /// the Update Status is called from the data layer for the CoreID and
        /// the Approved message is sent to the database, thereby only the status
        /// of that core info record is updated. The data is then bind in the grid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            //Todo: Set Coreid global in this page;

            DataLayer.DataOperator obj = new DataLayer.DataOperator();
            obj.UpdatesStaus(CoreID, "Approved");
            DetailsView1.DataBind();
        }
コード例 #3
0
        /// <summary>
        /// This method is for submitting the form for changing the current district of the user.
        /// It gets the selected value from the change district dropdown list. Then from the
        /// DataLayer DataOperator object, the district of the user is updated. Once updated
        /// it redirects the accountant back to the same page with the updated district displayed
        /// on screen and ready to change again if user (accountant) wishes to do so.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LinkButtonSubmit_Click(object sender, EventArgs e)
        {
            string getDistict = ddlDistinct.SelectedValue;
            int    getUid     = int.Parse(Request.QueryString["uid"]);

            DataLayer.DataOperator obj = new DataLayer.DataOperator();
            obj.UpdateDistrict(getUid, getDistict);
            Response.Redirect("acc_edit_district?did=" + getDistict + "&uid=" + getUid);
        }
コード例 #4
0
        /// <summary>
        /// Before the list of interventions page is loaded the district id
        /// of the user is obtained and the sql data source's select command is
        /// created to include the district ID for the current user, in order to
        /// display all the interventions that relate to that district.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            String UID = User.Identity.GetUserId().ToString();

            DataLayer.DataOperator  obj  = new DataLayer.DataOperator();
            IMS.DataLayer.view_user user = obj.GetUserByID(UID);

            int DID = user.Districts_ID;

            SqlDataSource1.SelectCommand = "SELECT [interventionTypes_name], [clients_name], [status], [iDate], [coreInfo_ID] FROM [view_detail_interventions] WHERE ([Districts_ID] = " + DID + ")";
        }
コード例 #5
0
ファイル: eng_list_client.aspx.cs プロジェクト: utsgithub/LTM
        /// <summary>
        /// For this page, before the page is loaded the User ID is obtained to gather the
        /// user ID from which the district ID is gathered in order to show a list of clients
        /// that belong to that specific district.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //int UID = int.Parse(User.Identity.GetUserId());
            String UID = User.Identity.GetUserId().ToString();

            DataLayer.DataOperator  obj  = new DataLayer.DataOperator();
            IMS.DataLayer.view_user user = obj.GetUserByID(UID);

            int DID = user.Districts_ID;

            SqlDataSource1.SelectCommand = "SELECT [name], [descriptive], [Districts], [clients_ID] FROM [view_client_list] WHERE ([district_id] = " + DID + ")";
        }
コード例 #6
0
        /// <summary>
        /// Before the create intervention page is loaded the detail of the intervention is acquired
        /// to select the correct intervention type. The date of the intervention is programatically
        /// inserted into the date textbox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int cid = int.Parse(Request.QueryString["cid"]);
                hfClientID.Value = cid.ToString();
                DataLayer.DataOperator obj    = new DataLayer.DataOperator();
                IMS.DataLayer.client   client = obj.GetClientByID(cid);
                LabelClient.Text = client.name;

                DataLayer.DataOperator dbo = new DataLayer.DataOperator();
                ddInt.DataSource = dbo.GetInterventionTypes();
                ddInt.DataBind();

                txtDate.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");
            }
        }
コード例 #7
0
 /// <summary>
 /// Once the cancel button is selected the CoreID property is used,
 /// the Update Status is called from the data layer for the CoreID and
 /// the Cancelled message is sent to the database, thereby only the status
 /// of that core info record is updated. The data is then bind in the grid view.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnCancelled_Click(object sender, EventArgs e)
 {
     DataLayer.DataOperator obj = new DataLayer.DataOperator();
     obj.UpdatesStaus(CoreID, "Cancelled");
     DetailsView1.DataBind();
 }