Example #1
0
        private void grid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                ScheduleProcess process = new ScheduleProcess();
                AutoComboBox    au      = new AutoComboBox();
                try
                {
                    List <DataRowView> listDataRow = getListSeletedDataRow();
                    if (listDataRow != null)
                    {
                        if (listDataRow.Count == 0)
                        {
                            LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                            return;
                        }
                        else if (listDataRow.Count > 1)
                        {
                            LMessage.ShowMessage("M.DungChung.KhongDuocChonNhieu", LMessage.MessageBoxType.Warning);
                            return;
                        }
                        else
                        {
                            id = (int)listDataRow.First()["ID"];
                        }
                    }
                    else
                    {
                    }

                    DataTable dt = null;
                    LDatatable.MakeParameterTable(ref dt);
                    LDatatable.AddParameter(ref dt, "@INP_ID_RESULT", "string", id.ToString());

                    DataSet ds = process.GetResultCT(dt);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            dr["FUNCTION_NAME"] = LLanguage.SearchResourceByKey(dr["FUNCTION_NAME"].ToString());
                        }

                        gridResultCT.ItemsSource = ds.Tables[0].DefaultView;
                        exdResultCT.IsExpanded   = true;
                    }
                }
                catch (System.Exception ex)
                {
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    process = null;
                    au      = null;
                    Mouse.OverrideCursor = Cursors.Arrow;
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
        }
Example #2
0
        private void gridResultCT_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                ScheduleProcess process = new ScheduleProcess();
                AutoComboBox    au      = new AutoComboBox();
                try
                {
                    List <DataRowView> listDataRow = getListSeletedDataRowCT();
                    if (listDataRow != null)
                    {
                        if (listDataRow.Count == 0)
                        {
                            LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning);
                            return;
                        }
                        else if (listDataRow.Count > 1)
                        {
                            LMessage.ShowMessage("M.DungChung.KhongDuocChonNhieu", LMessage.MessageBoxType.Warning);
                            return;
                        }
                        else
                        {
                            id = (int)listDataRow.First()["ID"];
                        }
                    }
                    else
                    {
                    }

                    DataTable dt = null;
                    LDatatable.MakeParameterTable(ref dt);
                    LDatatable.AddParameter(ref dt, "@INP_ID_RESULT_CT", "string", id.ToString());

                    DataSet ds = process.GetResultMessage(dt);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                        ClientResponseDetail        objRes = new ClientResponseDetail();
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            objRes           = new ClientResponseDetail();
                            objRes.Stt       = Convert.ToInt32(dr["STT"]);
                            objRes.Id        = Convert.ToInt32(dr["ID"]);
                            objRes.Object    = dr["OBJECT_CODE"].ToString();
                            objRes.Operation = dr["ACTION"].ToString();
                            objRes.Result    = dr["RESULT"].ToString();
                            objRes.Detail    = LLanguage.SearchResourceByKey(dr["MESSAGE"].ToString());

                            listClientResponseDetail.Add(objRes);
                        }

                        CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                    }
                }
                catch (System.Exception ex)
                {
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    process = null;
                    au      = null;
                    Mouse.OverrideCursor = Cursors.Arrow;
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
        }
Example #3
0
        private void Loadgrid()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                DataTable dt = null;
                LDatatable.MakeParameterTable(ref dt);

                string loaiDonVi = "";
                string donVi     = "";
                string tuNgay    = "";
                string denNgay   = "";
                if (tvwDonVi.SelectedItem == null)
                {
                    return;
                }
                string[] arrTree = ((RadTreeViewItem)tvwDonVi.SelectedItem).Tag.ToString().Split('#');
                if (arrTree.Count() > 1)
                {
                    donVi = arrTree[0];
                    if (arrTree[1] == "1")
                    {
                        loaiDonVi = "DVI";
                    }
                    else if (arrTree[1] == "2")
                    {
                        loaiDonVi = "CNH";
                    }
                    else if (arrTree[1] == "3")
                    {
                        loaiDonVi = "PGD";
                    }
                }

                if (raddtTuNgay.Value != null)
                {
                    tuNgay = Convert.ToDateTime(raddtTuNgay.Value).ToString("yyyyMMdd");
                }

                if (raddtDenNgay.Value != null)
                {
                    denNgay = Convert.ToDateTime(raddtDenNgay.Value).ToString("yyyyMMdd");
                }

                LDatatable.AddParameter(ref dt, "@INP_LOAI_DVI", "string", loaiDonVi);
                LDatatable.AddParameter(ref dt, "@INP_DON_VI", "string", donVi);
                LDatatable.AddParameter(ref dt, "@INP_TU_NGAY", "string", tuNgay);
                LDatatable.AddParameter(ref dt, "@INP_DEN_NGAY", "string", denNgay);
                LDatatable.AddParameter(ref dt, "@StartRow", "INT", StartRow.ToString());
                LDatatable.AddParameter(ref dt, "@EndRow", "INT", EndRow.ToString());

                DataSet ds = new ScheduleProcess().GetListCobInfomation(dt);
                if (ds != null && ds.Tables.Count > 0)
                {
                    grid.ItemsSource = ds.Tables[0].DefaultView;
                }
                else
                {
                    grid.ItemsSource = null;
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }

            Mouse.OverrideCursor = Cursors.Arrow;
        }