コード例 #1
0
        public void AddGroup(object pp)
        {
            string Id = pp as string;

            if (Id == "0")
            {
                if (SelectGm == null)
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Select Group", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else
                {
                    Import(null);
                    //if (ListOfAddGroup.Count == 0)
                    //{
                    //    CustomDialogBox tempDB = new CustomDialogBox("No Data found.", DialogType.Information);
                    //    tempDB.ShowDialog();
                    //}
                    //else
                    //{
                    //    foreach (GroupDetail item in ListOfAddGroup)
                    //    {
                    //        if (item.IsSelect == true)
                    //        {
                    //            item.GroupMaster = SelectGm;
                    //            item.GName = SelectGm.GroupName;
                    //            item.IsSelect = false;
                    //        }
                    //    }
                    //    FillAddGroup();
                    SelectGm = null;
                    CollectionViewSource.GetDefaultView(ListOfAddGroup).Refresh();
                    //}
                }
            }
            else if (Id == "1")
            {
                if (ListOfAddGroup.Count == 0)
                {
                    CustomDialogBox tempDB = new CustomDialogBox("No Data found.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else
                {
                    foreach (GroupDetail item in ListOfAddGroup)
                    {
                        _Entities.Entry(item).State = EntityState.Modified;
                    }
                    _Entities.SaveChanges();
                    CollectionViewSource.GetDefaultView(ListOfGroupD).Refresh();
                    CustomDialogBox tempDB = new CustomDialogBox("Saved Successfully", DialogType.Information);
                    tempDB.ShowDialog();
                    SelectGm = null;
                    FillAddGroup();
                    FrmVis2 = "Hidden";
                }
            }
        }
コード例 #2
0
 bool Cansave()
 {
     if (string.IsNullOrEmpty(Lable1))
     {
         CustomDialogBox tempDB = new CustomDialogBox("Enter Name.", DialogType.Information);
         tempDB.ShowDialog();
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #3
0
        private void btnNoPrint_Click(object sender, RoutedEventArgs e)
        {
            GroupDetail _Dm  = dgUsers.SelectedItem as GroupDetail;
            string      Type = Check16.IsChecked == true ? "L16" : "L24";

            if (string.IsNullOrEmpty(txtLabelNo.Text.Trim()))
            {
                CustomDialogBox tempDB = new CustomDialogBox("Enter LabelNo.", DialogType.Information);
                tempDB.ShowDialog();
                txtLabelNo.Focus();
            }
            else
            {
                //ReportWindow _ReportWindow = new ReportWindow(_Dm, txtLabelNo.Text, Type);
                //_ReportWindow.Show();
                //_ReportWindow.Closed += _ReportWindow_Closed;
            }
        }
コード例 #4
0
 public void Delete(object pp)
 {
     if (pp as string == "1")
     {
         if (ListOfGroupD.Where(a => a.IsCheck == true).Count() > 0)
         {
             ObservableCollection <GroupDetail> _GD = new ObservableCollection <GroupDetail>(ListOfGroupD.Where(w => w.IsCheck == true).ToList());
             foreach (GroupDetail item in _GD)
             {
                 item.IsDelete               = true;
                 item.DeleteDate             = DateTime.Now;
                 _Entities.Entry(item).State = EntityState.Modified;
                 _Entities.SaveChanges();
                 _ListOfGroupD.Remove(item);
             }
             CustomDialogBox tempDB = new CustomDialogBox("Successfully Delete.", DialogType.Information);
             tempDB.ShowDialog();
         }
         else
         {
             CustomDialogBox tempDB = new CustomDialogBox("No Date Found.", DialogType.Information);
             tempDB.ShowDialog();
         }
     }
     else
     {
         GroupDetail _DD = pp as GroupDetail;
         if (_DD != null)
         {
             CustomDialogBox tempDB = new CustomDialogBox("Are you sure ?", DialogType.Question);
             bool?           result = tempDB.ShowDialog();
             if (result == true)
             {
                 _DD.IsDelete               = true;
                 _DD.DeleteDate             = DateTime.Now;
                 _Entities.Entry(_DD).State = EntityState.Modified;
                 _Entities.SaveChanges();
                 _ListOfGroupD.Remove(_DD);
             }
         }
     }
 }
コード例 #5
0
 public void PrintGC(object pp)
 {
     if (NoLangthVis == "Visible")
     {
         string Id = pp as string;
         if (Id == "2")
         {
             PrintSFrmVis = "Hidden";
             NoLangthVis  = "Hidden";
             NoOfLable    = "";
         }
     }
     else
     {
         if (ListOfGroupD.Where(a => a.IsCheck == true).Count() > 0)
         {
             string Id = pp as string;
             if (Id == "1")
             {
                 PrintSFrmVis = "Visible";
                 NoLangthVis  = "Hidden";
             }
             else if (Id == "2")
             {
                 PrintSFrmVis = "Hidden";
                 NoLangthVis  = "Hidden";
             }
             else if (Id == "3")
             {
             }
         }
         else
         {
             CustomDialogBox tempDB = new CustomDialogBox("No Date Found.", DialogType.Information);
             tempDB.ShowDialog();
         }
     }
 }
コード例 #6
0
        public void Print(object pp)
        {
            string type = "";

            if (LableType == "Lable16")
            {
                type = "L16";
            }
            else if (LableType == "Lable24")
            {
                type = "L24";
            }
            else if (LableType == "Lable18")
            {
                type = "L18";
            }
            //PrintWindow _print = new PrintWindow(new ObservableCollection<object>(ListOfGroupD));
            //_print.ShowDialog();
            if (NoLangthVis == "Visible")
            {
                if (string.IsNullOrEmpty(LableType))
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Enter Lable.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else if (string.IsNullOrEmpty(NoOfLable))
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Enter LabelNo.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else if (string.IsNullOrEmpty(TextAlign))
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Select TextAlign.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else
                {
                    GroupDetail  _GRoupDetail  = new GroupDetail();
                    ReportWindow _ReportWindow = new ReportWindow(PrintGD, ListOfGridSC, NoOfLable, type, TextAlign, FontStyle, FontWeight, Font);
                    _ReportWindow.ShowDialog();
                }
            }
            else
            {
                if (ListOfGroupD.Where(a => a.IsCheck == true).Count() > 0)
                {
                    if (string.IsNullOrEmpty(LableType))
                    {
                        CustomDialogBox tempDB = new CustomDialogBox("Enter Lable.", DialogType.Information);
                        tempDB.ShowDialog();
                    }
                    else if (string.IsNullOrEmpty(TextAlign))
                    {
                        CustomDialogBox tempDB = new CustomDialogBox("Select TextAlign.", DialogType.Information);
                        tempDB.ShowDialog();
                    }
                    else
                    {
                        ObservableCollection <GroupDetail> _GD = new ObservableCollection <GroupDetail>(ListOfGroupD.Where(w => w.IsCheck == true).ToList());
                        foreach (GroupDetail item in _GD)
                        {
                            item.Lable5 = item.Lable5;
                        }
                        ReportWindow _ReportWindow = new ReportWindow(ListOfGridSC, _GD, type, TextAlign, FontStyle, FontWeight, Font);
                        _ReportWindow.ShowDialog();
                    }
                }
                else
                {
                    CustomDialogBox tempDB = new CustomDialogBox("No Date Found.", DialogType.Information);
                    tempDB.ShowDialog();
                }
            }
        }
コード例 #7
0
        public void Import(object pp)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.ShowDialog();
            try
            {
                string strFileType;
                strFileType = System.IO.Path.GetExtension(openFileDialog1.FileName).ToLower();
                if (strFileType != "")
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Are you sure you want to ImportDate ?", DialogType.Question);
                    bool?           result = tempDB.ShowDialog();
                    if (result == true)
                    {
                        if (strFileType != ".xlsx")
                        {
                            tempDB = new CustomDialogBox("ArePlease Select only Excel File with .xlsx Extension", DialogType.Information);
                            tempDB.ShowDialog();
                            openFileDialog1.ShowDialog();
                            strFileType = System.IO.Path.GetExtension(openFileDialog1.FileName).ToLower();
                        }
                        else
                        {
                            string path = openFileDialog1.FileName;

                            System.Data.DataTable dtExcel = new System.Data.DataTable();
                            dtExcel.TableName = "ImportPI";

                            string SourceConstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";

                            // string SourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='C:\Users\agite\Documents\Sheet1.xlsx';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'";
                            OleDbConnection  con   = new OleDbConnection(SourceConstr);
                            string           query = " select Lable1,Lable2,Lable3,Lable4,Lable5,Lable6,Lable7,Lable8,Lable9,Lable10 from [Sheet1$]";
                            OleDbDataAdapter data  = new OleDbDataAdapter(query, con);
                            data.Fill(dtExcel);
                            int res = 0;
                            List <GroupDetail> _GroupDetail = new List <GroupDetail>();
                            if (dtExcel.Rows.Count > 0)
                            {
                                foreach (DataRow row in dtExcel.Rows)
                                {
                                    GroupDetail GroupDetail = new GroupDetail();
                                    GroupDetail.GMId     = SelectGm.GroupId;
                                    GroupDetail.Lable1   = row["Lable1"].ToString();
                                    GroupDetail.Lable2   = row["Lable2"].ToString();
                                    GroupDetail.Lable3   = row["Lable3"].ToString();
                                    GroupDetail.Lable4   = row["Lable4"].ToString();
                                    GroupDetail.Lable5   = row["Lable5"].ToString();
                                    GroupDetail.Lable6   = row["Lable6"].ToString();
                                    GroupDetail.Lable7   = row["Lable7"].ToString();
                                    GroupDetail.Lable8   = row["Lable8"].ToString();
                                    GroupDetail.Lable9   = row["Lable9"].ToString();
                                    GroupDetail.Lable10  = row["Lable10"].ToString();
                                    GroupDetail.AddDate  = DateTime.Now;
                                    GroupDetail.IsDelete = false;
                                    _Entities.GroupDetails.Add(GroupDetail);
                                    _GroupDetail.Add(GroupDetail);
                                }
                                _Entities.SaveChanges();
                                CustomDialogBox tempDB1 = new CustomDialogBox("Imported Successfully.", DialogType.Information);
                                tempDB1.ShowDialog();
                                FillGroup();
                                FrmVis2 = "Hidden";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }