protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                ListTable myListTable = new ListTable();
                List<ListTable> aList = myListTable.GetAllListTable(_company.CompanyId);

                    ListTable tempListTable = aList[aList.Count - 1];
                   int id = tempListTable.Id + 1;

                myListTable.ListType = txtListType.Value;
                myListTable.ListId = id ;

                myListTable.ListValue = txtListValue.Value;
                myListTable.CompanyId = _company.CompanyId;

                myListTable.IsActive = true;
                myListTable.UpdateBy = _user.UserId;
                myListTable.UpdateDate = DateTime.Now;

                int sucess = 0;
                if (lblId.Text == "" || lblId.Text == "0")
                {
                    myListTable.Id = new ListTable().GetMaxListTableId() + 1;

                    sucess = myListTable.InsertListTable();

                    if (sucess > 0)
                    {
                        Alert.Show("List Table saved successfully");
                        this.Clear();
                    }
                }
                else
                {
                    myListTable.Id = int.Parse(lblId.Text);
                    sucess = myListTable.UpdateListTable();

                    if (sucess > 0)
                    {
                        Response.Redirect("ListTableLists.aspx", true);
                    }
                }
            }
            catch (Exception exp)
            {
                Alert.Show(exp.Message);
            }
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                ListTable myListTable = new ListTable();
                List<ListTable> aList = myListTable.GetAllListTable(_company.CompanyId);

                    ListTable tempListTable = aList[aList.Count - 1];
                   int id = tempListTable.Id + 1;

                myListTable.ListType = txtListType.Value;
                myListTable.ListId = id ;

                myListTable.ListValue = txtListValue.Value;
                myListTable.CompanyId = _company.CompanyId;

                myListTable.IsActive = true;
                myListTable.UpdateBy = user.UserId;
                myListTable.UpdateDate = DateTime.Now;

                int success = myListTable.InsertListTable();

                if (success > 0)
                {
                    Session["savedListMessage"] = "Saved List Table Successfully";
                    Response.Redirect(Request.RawUrl);

                }
                else
                {
                    Alert.Show("Error Occured while inserting a new List Table");
                }
            }
            catch (Exception exp)
            {
                Alert.Show(exp.Message);
            }
        }
        protected void RadGrid1_OnItemCommand(object sender, GridCommandEventArgs e)
        {
            GridDataItem item = (GridDataItem)e.Item;

            string id = item["colId"].Text;

            switch (e.CommandName)
            {
                case "btnSelect":
                    Response.Redirect("ListTableInfo.aspx?id=" + id, true);
                    break;
                case "btnDelete":
                    int delete = new ListTable().DeleteListTableById(int.Parse(id));

                    if (delete == 0)
                    {
                        Alert.Show("Data was not delete..");
                    }
                    else
                        LoadListTable();
                    break;
            }
        }
        private void LoadJournalDropDownList()
        {
            try
            {
                ListTable aNewListTable = new ListTable();
                List<ListTable> myList = aNewListTable.GetAllListTable(_company.CompanyId);
                journalTypeDropDownList.DataSource = myList;
                journalTypeDropDownList.DataTextField = "ListType";
                journalTypeDropDownList.DataValueField = "ListType";
                journalTypeDropDownList.DataBind();

            }
            catch (Exception exp)
            {
                Alert.Show(exp.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _company = (Company)Session["Company"];
              _user =(Users) Session["user"];
              if (Session["savedListMessage"] !=null)
              {
                  string msg = Session["savedListMessage"].ToString();
                  Alert.Show(msg);
                  Session["savedListMessage"] = null;
              }
              if (!isValidSession())
              {
                  string str = Request.QueryString.ToString();
                  if (str == string.Empty)
                      Response.Redirect("LogIn.aspx?refPage=index.aspx");
                  else
                      Response.Redirect("LogIn.aspx?refPage=index.aspx?" + str);
              }
              if (!IsPostBack)
              {
                  if (Request.QueryString["id"] != null)
                  {
                      string listId = Request.QueryString["id"].ToString();

                      ListTable objTable = new ListTable().GetListTableById(int.Parse(listId), _company.CompanyId);
                      if (objTable != null || objTable.Id != 0)
                      {
                          lblId.Text = objTable.Id.ToString();
                          txtListType.Value = objTable.ListType;
                          txtListValue.Value = objTable.ListValue;
                      }
                  }
              }
        }
        private void LoadListTable()
        {
            try
            {

                ListTable listTable = new ListTable();
                objListTables = listTable.GetAllListTable(_company.CompanyId);
                if (objListTables.Count == 0)
                    objListTables.Add(new ListTable());

                RadGrid1.DataSource = objListTables;
                RadGrid1.Rebind();
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
예제 #7
0
 void GetAllListTable()
 {
     ListTable listTable = new ListTable();
     myList = listTable.GetAllListTable(_company.CompanyId);
 }