Пример #1
0
 private void LoadDeptID()
 {
     GarasERP.User user = new GarasERP.User();
     if (user.LoadByPrimaryKey(UserID))
     {
         try
         {
             UserDeptID = user.DepartmentID;
         }
         catch (Exception ex)
         {
             UserDeptID = -1;
         }
     }
 }
Пример #2
0
        private void LoadTeam()
        {
            try
            {
                GarasERP.User team = new GarasERP.User();
                team.Where.DepartmentID.Value = UserDeptID;
                team.Where.ID.Value           = UserID;
                team.Where.ID.Operator        = WhereParameter.Operand.NotEqual;
                // Order by creation date asc
                team.Query.AddOrderBy(GarasERP.User.ColumnNames.CreationDate, WhereParameter.Dir.ASC);
                team.Query.Load();
                lblTeamCount.Text = team.RowCount == 1 ? "1 member" : team.RowCount + " members";
                if (team.RowCount > 0)
                {
                    List <long> myTeam = new List <long>();
                    team.Rewind(); //move to first record
                    do
                    {
                        myTeam.Add(team.ID);
                    } while (team.MoveNext());
                    TeamIDs = myTeam;

                    rptrMyTeam.DataSource = team.DefaultView
                                            .Cast <DataRowView>()
                                            .Take(TEAM_VIEW_COUNT).Select(r => r.Row);
                    rptrMyTeam.DataBind();
                }
                else
                {
                    rptrMyTeam.DataSource = null;
                    rptrMyTeam.DataBind();
                }
            }
            catch (Exception ex)
            {
                //Logger.LogException(ex);
            }
        }
Пример #3
0
        protected void BTN_Finish_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.Request.QueryString.Count > 0 && Page.Request.QueryString["RID"] != null)
                {
                    string ID     = GarasERP.Encrypt_Decrypt.Decrypt(Page.Request.QueryString["RID"].ToString(), key);
                    long   RID    = 0;
                    bool   hasNew = false;
                    if (long.TryParse(ID, out RID) && RID > 0)
                    {
                        DailyReport report = new DailyReport();

                        report.Where.ID.Value     = RID;
                        report.Where.Status.Value = "Pending Verification";
                        if (report.Query.Load())
                        {
                            if (report.DefaultView != null && report.DefaultView.Count > 0)
                            {
                                report.Status       = "Completed";
                                report.ModifiedDate = DateTime.Now;
                                report.ModifiedBy   = UserID;
                                // report.Note =
                                report.Review        = double.Parse(DDl_Review.SelectedValue);
                                report.ReviewComment = TXT_Desc.Text.Trim();
                                report.ReviewDate    = DateTime.Now;
                                report.Reviewed      = true;
                                report.ReviewedBy    = UserID;

                                report.Save();

                                string UserName = "";
                                long   BranchID = 0;
                                User   user     = new GarasERP.User();
                                if (user.LoadByPrimaryKey(UserID))
                                {
                                    UserName = user.FirstName + " " + user.LastName;
                                    if (user.s_BranchID != "")
                                    {
                                        BranchID = user.BranchID;
                                    }
                                }



                                Page.Response.Redirect("Reports.aspx", false);
                            }
                            else
                            {
                                LBL_MSG.Visible = true;
                                LBL_MSG.Text    = "Please Select Correct Report For edit";
                            }
                        }
                        else
                        {
                            LBL_MSG.Visible = true;
                            LBL_MSG.Text    = "Please Select Correct Report For edit";
                        }
                    }
                    else
                    {
                        LBL_MSG.Visible = true;
                        LBL_MSG.Text    = "Please Select Correct Report For edit";
                    }
                }
                else
                {
                    LBL_MSG.Visible = true;
                    LBL_MSG.Text    = "Please Select Correct Report For edit";
                }


                ///////////////////
            }
            catch (Exception ex)
            {
                LBL_MSG.Visible = true;
                LBL_MSG.Text    = "btn_Save:" + ex.Message;
                // Logger.LogException(ex);
            }
        }