Esempio n. 1
0
    public static LOCATIONGROUP GetLOCATIONGROUPByID(int id)
    {
        LOCATIONGROUP            lOCATIONGROUP            = new LOCATIONGROUP();
        SqlLOCATIONGROUPProvider sqlLOCATIONGROUPProvider = new SqlLOCATIONGROUPProvider();

        lOCATIONGROUP = sqlLOCATIONGROUPProvider.GetLOCATIONGROUPByID(id);
        return(lOCATIONGROUP);
    }
    private void loadLocation()
    {
        List <LOCATION> locations = new List <LOCATION>();

        if (Session["userType"] != null && (Session["lOCATION"] != null || Session["aGENT"] != null))
        {
            if (Session["userType"].ToString() == "Location")
            {
                LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP();
                lOCATIONGROUP = (LOCATIONGROUP)Session["lOCATION"];

                hfLoggedinLocationID.Value = lOCATIONGROUP.LOCATIONGROUPID.ToString();

                if (ddlAgent.SelectedItem.Text != "All Agents")
                {
                    locations = LOCATIONManager.GetAllLOCATIONsByAgentIDnGroupID(int.Parse(ddlAgent.SelectedItem.Value), int.Parse(hfLoggedinLocationID.Value));
                }
                else
                {
                    locations = LOCATIONManager.GetAllLOCATIONsByGroupID(int.Parse(hfLoggedinLocationID.Value));
                }
                //locations = LOCATIONManager.GetAllLOCATIONsByGroupID(int.Parse(hfLoggedinLocationID.Value));
                //trLocation.Visible = false;
            }
            else if (Session["userType"].ToString() == "Agent")
            {
                AGENT aGENT = (AGENT)Session["aGENT"];
                hfAgentID.Value = aGENT.AGENTID.ToString();

                trLocation.Visible = true;
                if (hfAgentID.Value == "4")
                {
                    if (ddlAgent.SelectedItem.Text != "All Agents")
                    {
                        locations = LOCATIONManager.GetAllLOCATIONsByAgentID(int.Parse(ddlAgent.SelectedItem.Value));
                    }
                    else
                    {
                        locations = LOCATIONManager.GetAllLOCATIONs();
                    }
                }
                else
                {
                    locations = LOCATIONManager.GetAllLOCATIONsByAgentID(int.Parse(hfAgentID.Value));
                }
            }

            dlLocation.DataSource = locations;
            dlLocation.DataBind();
            tblSearchByRefCode.Visible = false;
        }
        else
        {
            Session.RemoveAll(); Response.Redirect("LogInPage.aspx");
        }
    }
Esempio n. 3
0
    private void loadLogin()
    {
        if (User.Identity.IsAuthenticated && Session["userType"] != null && (Session["aGENT"] != null || Session["lOCATION"] != null))
        {
            if (Session["userType"].ToString() == "Location")
            {
                LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP();
                lOCATIONGROUP            = (LOCATIONGROUP)Session["lOCATION"];
                a_locationReport.Visible = true;
                a_transferMoney.Visible  = false;
                a_foodItems.Visible      = false;
                a_editTransfer.Visible   = true;
                a_dailyReport.Visible    = false;
                //a_dailyReport.HRef = "ReportLocationWiseDaily.aspx";

                a_compliance.Visible      = false;
                a_agentWiseReport.Visible = false;
                a_agentCommReport.Visible = false;
                a_administrator.Visible   = false;
            }
            else
            {
                AGENT aGENT = new AGENT();
                aGENT = (AGENT)Session["aGENT"];

                if (aGENT.AGENTID == 4) //for admin
                {
                    //a_transferMoney.Visible = false;
                    //a_dailyReport.HRef = "ReportAgentWiseDaily.aspx";
                }
                else
                {
                    a_transferMoney.Visible  = true;
                    a_locationReport.Visible = true;
                    a_foodItems.Visible      = true;
                    a_editTransfer.Visible   = true;
                    a_dailyReport.Visible    = true;
                    //a_dailyReport.HRef = "ReportLocationWiseDaily.aspx";

                    a_compliance.Visible      = false;
                    a_agentWiseReport.Visible = false;
                    a_agentCommReport.Visible = false;
                    a_administrator.Visible   = false;
                }
            }
        }
        else
        {
            Session.RemoveAll(); Response.Redirect("LogInPage.aspx");
        }
    }
Esempio n. 4
0
    public bool UpdateLOCATIONGROUP(LOCATIONGROUP lOCATIONGROUP)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AbiMatuEnterprise_UpdateLOCATIONGROUP", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@LOCATIONGROUPID", SqlDbType.Int).Value = lOCATIONGROUP.LOCATIONGROUPID;
            cmd.Parameters.Add("@ADDEDDATE", SqlDbType.DateTime).Value  = lOCATIONGROUP.ADDEDDATE;
            cmd.Parameters.Add("@GROUPNAME", SqlDbType.NVarChar).Value  = lOCATIONGROUP.GROUPNAME;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
Esempio n. 5
0
 public LOCATIONGROUP GetLOCATIONGROUPFromReader(IDataReader reader)
 {
     try
     {
         LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP
                                       (
             (int)reader["LOCATIONGROUPID"],
             (DateTime)reader["ADDEDDATE"],
             reader["GROUPNAME"].ToString()
                                       );
         return(lOCATIONGROUP);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Esempio n. 6
0
 protected void lbSelect_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton linkButton = new LinkButton();
         linkButton = (LinkButton)sender;
         int id;
         id = Convert.ToInt32(linkButton.CommandArgument);
         LOCATIONGROUP locationGroup = LOCATIONGROUPManager.GetLOCATIONGROUPByID(id);
         if (locationGroup != null)
         {
             txtGROUPNAME.Text = locationGroup.GROUPNAME;
             hdnGroupID.Value  = locationGroup.LOCATIONGROUPID.ToString();
             btnAdd.Visible    = false;
             btnUpdate.Visible = true;
         }
     }
     catch { }
 }
Esempio n. 7
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP();

            lOCATIONGROUP.ADDEDDATE = DateTime.Now;
            lOCATIONGROUP.GROUPNAME = txtGROUPNAME.Text;
            int resutl = LOCATIONGROUPManager.InsertLOCATIONGROUP(lOCATIONGROUP);
            if (resutl > 0)
            {
                lblErr.Text = "successfully added!";
                btnClear_Click(null, null);
                showLOCATIONGROUPGrid();
            }
        }
        catch (Exception ex)
        {
            lblErr.Text = ex.Message;
        }
    }
Esempio n. 8
0
    private void showLOCATIONMAPPINGGrid()
    {
        gvLOCATIONMAPPING.DataSource = LOCATIONMAPPINGManager.GetAllLOCATIONMAPPINGs();
        gvLOCATIONMAPPING.DataBind();
        foreach (GridViewRow gvr in gvLOCATIONMAPPING.Rows)
        {
            Label lblLOCATIONID      = gvr.FindControl("lblLOCATIONID") as Label;
            Label lblLOCATIONGROUPID = gvr.FindControl("lblLOCATIONGROUPID") as Label;

            LOCATION location = LOCATIONManager.GetLOCATIONByID(int.Parse(lblLOCATIONID.Text));
            if (location != null)
            {
                lblLOCATIONID.Text = location.COUNTRY + ", " + location.CITY + ", " + location.BRANCH;
            }

            LOCATIONGROUP locationGroup = LOCATIONGROUPManager.GetLOCATIONGROUPByID(int.Parse(lblLOCATIONGROUPID.Text));
            if (locationGroup != null)
            {
                lblLOCATIONGROUPID.Text = locationGroup.GROUPNAME;
            }
        }
    }
Esempio n. 9
0
 private void loadLogin()
 {
     if (Session["userType"] != null && (Session["aGENT"] != null || Session["lOCATION"] != null))
     {
         if (Session["userType"].ToString() == "Location")
         {
             LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP();
             lOCATIONGROUP     = (LOCATIONGROUP)Session["lOCATION"];
             lblAgentName.Text = lOCATIONGROUP.GROUPNAME.ToString();
         }
         else
         {
             AGENT aGENT = new AGENT();
             aGENT             = (AGENT)Session["aGENT"];
             lblAgentName.Text = aGENT.AGENTNAME.ToString();
         }
     }
     else
     {
         Session.RemoveAll(); Response.Redirect("LogInPage.aspx");
     }
 }
Esempio n. 10
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP();
            lOCATIONGROUP = LOCATIONGROUPManager.GetLOCATIONGROUPByID(Int32.Parse(hdnGroupID.Value));
            LOCATIONGROUP tempLOCATIONGROUP = new LOCATIONGROUP();
            tempLOCATIONGROUP.LOCATIONGROUPID = lOCATIONGROUP.LOCATIONGROUPID;

            tempLOCATIONGROUP.ADDEDDATE = DateTime.Now;
            tempLOCATIONGROUP.GROUPNAME = txtGROUPNAME.Text;
            bool result = LOCATIONGROUPManager.UpdateLOCATIONGROUP(tempLOCATIONGROUP);
            if (result == true)
            {
                lblErr.Text = "successfully updated!";
                btnClear_Click(null, null);
                showLOCATIONGROUPGrid();
            }
        }
        catch (Exception ex)
        {
            lblErr.Text = ex.Message;
        }
    }
Esempio n. 11
0
    public static bool UpdateLOCATIONGROUP(LOCATIONGROUP lOCATIONGROUP)
    {
        SqlLOCATIONGROUPProvider sqlLOCATIONGROUPProvider = new SqlLOCATIONGROUPProvider();

        return(sqlLOCATIONGROUPProvider.UpdateLOCATIONGROUP(lOCATIONGROUP));
    }
Esempio n. 12
0
    public static int InsertLOCATIONGROUP(LOCATIONGROUP lOCATIONGROUP)
    {
        SqlLOCATIONGROUPProvider sqlLOCATIONGROUPProvider = new SqlLOCATIONGROUPProvider();

        return(sqlLOCATIONGROUPProvider.InsertLOCATIONGROUP(lOCATIONGROUP));
    }