Esempio n. 1
0
    public static bool AddInSociety(SocUser sUser)
    {
        Resident newResident = new Resident();

        bool result = newResident.AddSocietyUser(mUser.UserID, sUser.FlatId, sUser.SocietyId);

        return(result);
    }
Esempio n. 2
0
    protected void btnEmployeeAdd_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtEmployeeCompanyName.Text == "")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert('Wrong Flat ID')", true);
                return;
            }

            String CompanyName = txtEmployeeCompanyName.Text;


            int SetrviceType = Convert.ToInt32(drpServiceType.SelectedValue);



            int UserID = ExistingUserID;

            String ResidentType = "Employee";

            Resident res = new Resident();

            res.UserID       = ExistingUserID;
            res.FlatID       = 0;
            res.SocietyID    = muser.currentResident.SocietyID;
            res.Status       = 2;
            res.UserType     = ResidentType;
            res.ServiceType  = SetrviceType;
            res.DeActiveDate = DateTime.UtcNow.AddYears(5);

            if (!res.IsUserExist())
            {
                bool result = res.AddSocietyUser();
                if (result)
                {
                    FillEmployeeData();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:hideAddEmployeeModal()", true);
                }
                else
                {
                    lblUserCheck.Text = "Error Updating Employee";
                }
            }
            else
            {
                lblUserCheck.Text = "Employee already Exist";
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert(Error)", true);
        }
    }
Esempio n. 3
0
    protected void btnAssignSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (HiddenField1.Value.ToString() != "")
            {
                FlatID = Convert.ToInt32(HiddenField1.Value.ToString());
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert('Wrong Flat ID')", true);
                return;
            }


            int UserID = ExistingUserID;

            String ResidentType = HiddenField3.Value.ToString();

            Resident res = new Resident();

            DataSet owner = res.GetActiveOwner(FlatID, muser.currentResident.SocietyID);

            if (owner != null)
            {
                if (owner.Tables[0].Rows.Count > 0)
                {
                    String Name = "";
                    try
                    {
                        Name = owner.Tables[0].Rows[0]["FirstName"].ToString() + owner.Tables[0].Rows[0]["LastName"].ToString();
                    }
                    catch (Exception ex)
                    {
                    }

                    lblUserCheck.Text = "Selected Flat Already has an Active User " + Name;
                }
                else
                {
                    res.UserID    = ExistingUserID;
                    res.FlatID    = FlatID;
                    res.SocietyID = muser.currentResident.SocietyID;
                    res.Status    = 2;
                    res.UserType  = ResidentType;

                    bool result = res.AddSocietyUser();

                    if (result)
                    {
                        FillFlatdata();
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:hideAssignFlatModal()", true);
                    }
                    else
                    {
                        lblUserCheck.Text = "Error Updating Owner for Flat, Try Later";
                    }
                }
            }
            else
            {
                lblUserCheck.Text = "Error connecting Data Base";
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert(Error)", true);
        }
    }