Esempio n. 1
0
        private void radGridView_preciounidadequivalente_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F1 || e.KeyCode == Keys.F2)
                {
                    if (radGridView_preciounidadequivalente.Rows.Count > 0)
                    {
                        if (radGridView_preciounidadequivalente.CurrentCell != null)
                        {
                            if (radGridView_preciounidadequivalente.CurrentCell.RowIndex != -1)
                            {
                                RadFormPrecio radFormPrecio = new RadFormPrecio()
                                {
                                    Sesion = Sesion,
                                    Precio = new Precio()
                                    {
                                        Idprecio   = e.KeyCode == Keys.F1 ? 0 : int.Parse(radGridView_preciounidadequivalente.Rows[radGridView_preciounidadequivalente.CurrentCell.RowIndex].Cells["idprecio"].Value.ToString()),
                                        Tipoprecio = e.KeyCode == Keys.F1 ? new TipoPrecio()
                                        {
                                            Idtipoprecio = 0
                                        }:new TipoPrecio()
                                        {
                                            Idtipoprecio = int.Parse(radGridView_preciounidadequivalente.Rows[radGridView_preciounidadequivalente.CurrentCell.RowIndex].Cells["idtipoprecio"].Value.ToString())
                                        },
                                        Unidadequivalente = new UnidadEquivalente()
                                        {
                                            Idunidadequivalente = int.Parse(radGridView_preciounidadequivalente.Rows[radGridView_preciounidadequivalente.CurrentCell.RowIndex].Cells["idunidadequivalente"].Value.ToString()),
                                            Unidadmedida        = new UnidadMedida()
                                            {
                                                Sigla = radGridView_preciounidadequivalente.Rows[radGridView_preciounidadequivalente.CurrentCell.RowIndex].Cells["umsigla"].Value.ToString()
                                            }
                                        },
                                        Valor = e.KeyCode == Keys.F1 ? 0.00m : decimal.Parse(radGridView_preciounidadequivalente.Rows[radGridView_preciounidadequivalente.CurrentCell.RowIndex].Cells["precio"].Value.ToString())
                                    }
                                };

                                radFormPrecio.ShowDialog();
                                Sp_listar_precioxidunidadequivalente(radGridView_unidadequivalente.CurrentCell.RowIndex);
                            }
                        }
                    }
                    else
                    {
                        if (e.KeyCode == Keys.F1)
                        {
                            RadFormPrecio radFormPrecio = new RadFormPrecio()
                            {
                                Sesion = Sesion,
                                Precio = new Precio()
                                {
                                    Idprecio   = 0,
                                    Tipoprecio = new TipoPrecio()
                                    {
                                        Idtipoprecio = 0
                                    },
                                    Unidadequivalente = new UnidadEquivalente()
                                    {
                                        Idunidadequivalente = int.Parse(radGridView_unidadequivalente.Rows[radGridView_unidadequivalente.CurrentCell.RowIndex].Cells["idunidadequivalente"].Value.ToString()),
                                        Unidadmedida        = new UnidadMedida()
                                        {
                                            Sigla = radGridView_unidadequivalente.Rows[radGridView_unidadequivalente.CurrentCell.RowIndex].Cells["unisigla"].Value.ToString()
                                        }
                                    },
                                    Valor = 0.00m
                                }
                            };

                            radFormPrecio.ShowDialog();
                            Sp_listar_precioxidunidadequivalente(radGridView_unidadequivalente.CurrentCell.RowIndex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.Show(ex.Message.ToString());
            }
        }
Esempio n. 2
0
        private void radGridView2_CommandCellClick(object sender, EventArgs e)
        {
            string lappenjid;
            GridCommandCellElement cell = (GridCommandCellElement)sender;
            string question             = string.Empty;

            if (cell.RowInfo.Cells["NOSJ"].Value.ToString() == "KAS")
            {
                question = "Yakin " + cell.RowInfo.Cells["sopirname"].Value.ToString()
                           + " sudah kembali dari belanja ?";
            }
            else
            {
                question = "Yakin mobil " + cell.RowInfo.Cells["mobilname"].Value.ToString() + " oleh sopir "
                           + cell.RowInfo.Cells["sopirname"].Value.ToString()
                           + " sudah kembali dari "
                           + cell.RowInfo.Cells["tujuan"].Value.ToString();
            }
            switch (cell.CommandButton.TextElement.Text)
            {
            case "Input Laporan":
                //Print
                DialogResult res = RadMessageBox.Show(question, "SMS - Verification"
                                                      , MessageBoxButtons.OKCancel
                                                      , RadMessageIcon.Question
                                                      , MessageBoxDefaultButton.Button2);
                if (res == System.Windows.Forms.DialogResult.OK)
                {
                    //Create Laporan
                    using (sinarekDataSetTableAdapters.lappenTableAdapter tbl = new sinarekDataSetTableAdapters.lappenTableAdapter())
                    {
                        try
                        {
                            if (cell.RowInfo.Cells["NOSJ"].Value.ToString() != "KAS")
                            {
                                lappenjid = tbl.pInsertLapPenj(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString())
                                                               , DateTime.Now
                                                               , DateTime.Now
                                                               , NBConfig.ValidUserName
                                                               , "UJ").ToString();
                                EditLaporan(lappenjid
                                            , cell.RowInfo.Cells["NOSJ"].Value.ToString()
                                            , false);
                            }
                            else
                            {
                                lappenjid = tbl.pInsertLapPenj(int.Parse(cell.RowInfo.Cells["ujid"].Value.ToString())
                                                               , DateTime.Now
                                                               , DateTime.Now
                                                               , NBConfig.ValidUserName
                                                               , "UB").ToString();
                                EditLaporanUB(radGridView2, lappenjid
                                              , cell.RowInfo.Cells["NOSJ"].Value.ToString()
                                              , false);
                            }

                            this.uangjalanTableAdapter.FillByNoLap(this.sinarekDataSet.uangjalan);
                            this.vlappenTableAdapter.FillByTanggal(this.sinarekDataSet.vlappen, dtpTanggalLaporan.Value, "UJ");
                            sinarekDataSet.vlappenDataTable dt = new sinarekDataSet.vlappenDataTable();
                            this.vlappenTableAdapter.FillByTanggal(dt, dtpTanggalKas.Value, "UB");
                            radGridView4.DataSource = dt;
                        }
                        catch (Exception ex)
                        {
                            helper.NotifMessage("Laporan UJ untuk " + cell.RowInfo.Cells["NOSJ"].Value.ToString() + " sudah terinput.");
                            helper.SysLog(this.GetType().Name, this.Text, "Create Laporan UJ :" + ex.Message);
                            //lappenjid = tbl.GetLapPenID(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString()), "UJ").ToString();
                        }
                    }
                }
                break;

            case "Batal":
                DialogResult res2 = RadMessageBox.Show("Yakin uang jalan mobil " + cell.RowInfo.Cells["mobilname"].Value.ToString() + " oleh sopir "
                                                       + cell.RowInfo.Cells["sopirname"].Value.ToString()
                                                       + " tujuan ke "
                                                       + cell.RowInfo.Cells["tujuan"].Value.ToString() + " akan dibatalkan ?", "SMS - Verification"
                                                       , MessageBoxButtons.OKCancel
                                                       , RadMessageIcon.Question
                                                       , MessageBoxDefaultButton.Button2);
                if (res2 == System.Windows.Forms.DialogResult.OK)
                {
                    this.uangjalanTableAdapter.UpdateStatus(3, NBConfig.ValidUserName
                                                            , int.Parse(cell.RowInfo.Cells["ujid"].Value.ToString()));
                    this.uangjalanTableAdapter.FillByNoLap(this.sinarekDataSet.uangjalan);
                    this.vlappenTableAdapter.FillByTanggal(this.sinarekDataSet.vlappen, dtpTanggalLaporan.Value, "UJ");
                }
                break;
            }
        }
Esempio n. 3
0
        private void InitMaterialCostGridView()
        {
            this.gvMaterialCost.AddNewRowPosition   = SystemRowPosition.Top;
            this.gvMaterialCost.EnableFiltering     = true;
            this.gvMaterialCost.AllowAddNewRow      = true;
            this.gvMaterialCost.AllowSearchRow      = true;
            this.gvMaterialCost.AutoGenerateColumns = false;

            //var lst = bll.Select<QuoLayer>();
            //var dLst = new List<ComboboxItemModel>();
            //foreach (var i in lst)
            //{
            //    dLst.Add(new ComboboxItemModel {  DisplayMember=i.LayerName,ValueMember=i.Id});
            //}
            GridViewComboBoxColumn c1 = new GridViewComboBoxColumn();

            c1.DataSource       = cmbLayer;
            c1.HeaderText       = "层数";
            c1.Name             = "LayerId";
            c1.FieldName        = "LayerId";
            c1.ValueMember      = "ValueMember";
            c1.DisplayMember    = "DisplayMember";
            c1.FilteringMode    = GridViewFilteringMode.DisplayMember;
            c1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            c1.Width            = 80;
            this.gvMaterialCost.Columns.Add(c1);
            GridViewComboBoxColumn c2 = new GridViewComboBoxColumn();

            c2.DataSource       = cmbMaterial;
            c2.HeaderText       = "物料名称";
            c2.Name             = "MaterialId";
            c2.FieldName        = "MaterialId";
            c2.ValueMember      = "ValueMember";
            c2.DisplayMember    = "DisplayMember";
            c2.FilteringMode    = GridViewFilteringMode.DisplayMember;
            c2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            c2.Width            = 100;
            c2.WrapText         = true;
            this.gvMaterialCost.Columns.Add(c2);
            GridViewTextBoxColumn c3 = new GridViewTextBoxColumn();

            c3.HeaderText = "价格";
            c3.Name       = "Cost";
            c3.FieldName  = "Cost";
            c3.Width      = 80;
            this.gvMaterialCost.Columns.Add(c3);
            GridViewTextBoxColumn c4 = new GridViewTextBoxColumn();

            c4.HeaderText = "备注";
            c4.Name       = "Remark";
            c4.FieldName  = "Remark";
            c4.Width      = 100;
            c4.WrapText   = true;
            this.gvMaterialCost.Columns.Add(c4);


            this.gvMaterialCost.UserDeletingRow += (s, e) => {
                if (RadMessageBox.Show(this, "确认删除所选行?", "", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }
                if (e.Rows != null && e.Rows.Count() > 0)
                {
                    delIds.Clear();
                    foreach (var row in e.Rows)
                    {
                        var tmp = row.DataBoundItem as QuoMaterialCost;
                        if (tmp != null && tmp.Id > 0)
                        {
                            delIds.Add(tmp.Id);
                        }
                    }
                }
            };
            this.gvMaterialCost.UserDeletedRow += (s, e) => {
                if (delIds != null && delIds.Count > 0)
                {
                    Task.Factory.StartNew(() => {
                        bll.Delete <QuoMaterialCost>(delIds);
                    }).ContinueWith(t => {
                        if (t.IsFaulted)
                        {
                            syncContext.Post((state) => {
                                LoadMaterialCostData();
                            }, null);
                        }
                    });
                }
            };

            this.gvMaterialCost.UserAddedRow += (s, e) => {
                var tmp = e.Row.DataBoundItem as QuoMaterialCost;
                if (tmp != null)
                {
                    Task.Factory.StartNew <QuoMaterialCost>(() => {
                        return(bll.Insert(tmp));
                    }).ContinueWith(t => {
                        if (!t.IsFaulted)
                        {
                            syncContext.Post((state) => {
                                LoadMaterialCostData();
                            }, null);
                        }
                    });
                }
            };


            this.gvMaterialCost.CellValueChanged += (s, e) => {
                var cur = e.Row.DataBoundItem as QuoMaterialCost;
                Task.Factory.StartNew(() =>
                {
                    bll.Update <QuoMaterialCost>(cur.Id, e.Column.FieldName, e.Value);
                }).ContinueWith(t => {
                    if (!t.IsFaulted)
                    {
                        syncContext.Post((state) => {
                            LoadMaterialCostData();
                        }, null);
                    }
                });
            };

            //验证
            this.gvMaterialCost.CellValidating += (s, e) => {
                GridViewDataColumn column = e.Column as GridViewDataColumn;
                if ((e.Row is GridViewNewRowInfo || e.Row is GridViewDataRowInfo) && column != null && column.Name == "LayerId")//
                {
                    if (e.Value == null || ((int)e.Value) <= 0)
                    {
                        e.Cancel        = true;
                        e.Row.ErrorText = "Validation error!";
                        //((GridViewDataRowInfo)e.Row).ErrorText = "Validation error!";
                    }
                    else
                    {
                        ((GridViewDataRowInfo)e.Row).ErrorText = string.Empty;
                    }
                }
                if ((e.Row is GridViewNewRowInfo || e.Row is GridViewDataRowInfo) && column != null && column.Name == "MaterialId")//
                {
                    if (e.Value == null || ((int)e.Value) <= 0)
                    {
                        e.Cancel        = true;
                        e.Row.ErrorText = "Validation error!";
                        //((GridViewDataRowInfo)e.Row).ErrorText = "Validation error!";
                    }
                    else
                    {
                        e.Row.ErrorText = string.Empty;
                    }
                }
            };
            ////initialize default values for the new row
            //this.gvMaterialCost.DefaultValuesNeeded += (s, e) => {
            //    var currentMaterial = this.gvMaterial.CurrentRow.DataBoundItem as QuoMaterial;
            //    e.Row.Cells["MaterialId"].Value = currentMaterial.Id;
            //};

            //initialize default values for the data row
            //this.gvMaterialCost.CellEditorInitialized += (s, e) => {
            //    if (e.Row is GridViewDataRowInfo)

            //    {

            //        if (e.Column.Name == "ContactName")

            //        {

            //            e.ActiveEditor.Value = "Default Value";

            //        }

            //    }
            //};

            this.gvMaterialCost.CellFormatting += (s, e) => {
                //if (e.Row is GridViewDataRowInfo && e.Column.Name == "LayerId" && e.Row.Cells["LayerId"].Value == null)
                //{
                //    e.Row.Cells["LayerId"].Value = (e.Row.DataBoundItem as QuoMaterialCost).LayerId;

                //}
            };
        }
        private void cmdUpdate_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            if (sstMethods0.Enabled == true)
            {
                if (string.IsNullOrEmpty(txtTypeinValue.Text) & chkBlank.CheckState == 0)
                {
                    RadMessageBox.Show("Please define a value before updating the criteria");
                }
                else if (chkBlank.CheckState == CheckState.Checked)
                {
                    modGlobal.gv_sql = "update tbl_Setup_MeasureCriteria ";
                    modGlobal.gv_sql = modGlobal.gv_sql + " set fieldvalue = 'Null' ";
                    modGlobal.gv_sql = modGlobal.gv_sql + ", dateunit = null ";
                    //UPGRADE_WARNING: Couldn't resolve default property of object mcid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    modGlobal.gv_sql = modGlobal.gv_sql + " where MeasureCriteriaID  = " + mcid;
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                }
                else
                {
                    //If (mid(selectedfieldtype, 1, 3) = "Num" Or selectedcritfieldoperator <> "") And Not IsNumeric(txtTypeinValue) Then
                    //UPGRADE_WARNING: Couldn't resolve default property of object selectedcritfieldoperator. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    if ((Strings.Mid(selectedfieldtype, 1, 3) == "Num" | !string.IsNullOrEmpty(selectedcritfieldoperator)) & !Information.IsNumeric(txtTypeinValue.Text) & Strings.UCase(Strings.Trim(txtTypeinValue.Text)) != "UTD")
                    {
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        RadMessageBox.Show(selectedfieldname + " is a numeric field, but the value is not a number. Please re-Specify...");
                        return;
                    }

                    //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    if ((Strings.Mid(selectedfieldtype, 1, 3) == "Dat" | Strings.Mid(selectedfieldtype, 1, 3) == "Tim") & Strings.UCase(Strings.Trim(txtTypeinValue.Text)) == "UTD")
                    {
                        //this is OK
                    }
                    else
                    {
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedcritfieldoperator. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        if (Strings.Mid(selectedfieldtype, 1, 3) == "Dat" & string.IsNullOrEmpty(selectedcritfieldoperator) & !Information.IsDate(txtTypeinValue.Text))
                        {
                            //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                            RadMessageBox.Show(selectedfieldname + " is a date field, but the value is not a date. Please re-Specify...");
                            return;
                        }
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedcritfieldoperator. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        if (Strings.Mid(selectedfieldtype, 1, 3) == "Tim" & string.IsNullOrEmpty(selectedcritfieldoperator) & (Strings.Len(txtTypeinValue.Text) != 5))
                        {
                            //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                            RadMessageBox.Show(selectedfieldname + " is a Time field, but the value is not in the appropriate format (HH:MM military). Please re-Specify...");
                            return;
                        }
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedcritfieldoperator. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        if (Strings.Mid(selectedfieldtype, 1, 3) == "Tim" & string.IsNullOrEmpty(selectedcritfieldoperator) & ((!Information.IsNumeric(Strings.Mid(txtTypeinValue.Text, 1, 1))) | (!Information.IsNumeric(Strings.Mid(txtTypeinValue.Text, 2, 1))) | (Strings.Mid(txtTypeinValue.Text, 3, 1) != ":") | (!Information.IsNumeric(Strings.Mid(txtTypeinValue.Text, 4, 1))) | (!Information.IsNumeric(Strings.Mid(txtTypeinValue.Text, 5, 1)))))
                        {
                            //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                            RadMessageBox.Show(selectedfieldname + " is a Time field, but the value is not in the appropriate format (HH:MM military). Please re-Specify...");
                            return;
                        }
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedcritfieldoperator. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                        if (Strings.Mid(selectedfieldtype, 1, 3) == "Tim" & string.IsNullOrEmpty(selectedcritfieldoperator) & (Convert.ToDouble(Strings.Mid(txtTypeinValue.Text, 1, 2)) > 23 | Convert.ToDouble(Strings.Mid(txtTypeinValue.Text, 4, 2)) > 59))
                        {
                            //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                            RadMessageBox.Show(selectedfieldname + " is a Time field, but the value is not in the appropriate format (HH:MM military). Please re-Specify...");
                            return;
                        }
                    }

                    //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldtype. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    //UPGRADE_WARNING: Couldn't resolve default property of object selectedcritfieldoperator. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    //UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
                    if ((!Information.IsDBNull(selectedcritfieldoperator) & !string.IsNullOrEmpty(selectedcritfieldoperator)) & (Strings.Mid(selectedfieldtype, 1, 3) == "Tim" | Strings.Mid(selectedfieldtype, 1, 3) == "Dat"))
                    {
                        if (string.IsNullOrEmpty(cboDateUnit.Text))
                        {
                            //UPGRADE_WARNING: Couldn't resolve default property of object selectedfieldname. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                            RadMessageBox.Show(selectedfieldname + " is a Date/Time field. Please select a date unit");
                            return;
                        }
                    }
                    else
                    {
                        cboDateUnit.Text = "";
                    }

                    modGlobal.gv_sql = "update tbl_Setup_MeasureCriteria ";
                    modGlobal.gv_sql = modGlobal.gv_sql + " set fieldvalue = '" + txtTypeinValue.Text + "' ";
                    if (!string.IsNullOrEmpty(cboDateUnit.Text))
                    {
                        modGlobal.gv_sql = modGlobal.gv_sql + ", dateunit = ";
                        switch (cboDateUnit.Text)
                        {
                        case "Years":
                            modGlobal.gv_sql = modGlobal.gv_sql + " 'YYYY' ";
                            break;

                        case "Months":
                            modGlobal.gv_sql = modGlobal.gv_sql + " 'm' ";
                            break;

                        case "Days":
                            modGlobal.gv_sql = modGlobal.gv_sql + " 'd' ";
                            break;

                        case "Hours":
                            modGlobal.gv_sql = modGlobal.gv_sql + " 'h' ";
                            break;

                        case "Minutes":
                            modGlobal.gv_sql = modGlobal.gv_sql + " 'n' ";
                            break;

                        case "Seconds":
                            modGlobal.gv_sql = modGlobal.gv_sql + " 's' ";
                            break;
                        }
                    }
                    //UPGRADE_WARNING: Couldn't resolve default property of object mcid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    modGlobal.gv_sql = modGlobal.gv_sql + " where MeasureCriteriaID  = " + mcid;
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                }
            }
            else if (sstMethods1.Enabled == true)
            {
                modGlobal.gv_sql = "update tbl_Setup_MeasureCriteria ";
                modGlobal.gv_sql = modGlobal.gv_sql + " set destddid = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboDestField, cboDestField.SelectedIndex);
                //UPGRADE_WARNING: Couldn't resolve default property of object mcid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                modGlobal.gv_sql = modGlobal.gv_sql + " where MeasureCriteriaID  = " + mcid;
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
            }
            else if (sstMethods2.Enabled == true)
            {
                modGlobal.gv_sql = "Select thislookupid = ";
                modGlobal.gv_sql = modGlobal.gv_sql + " case when td.comparetodesc = 'Yes' ";
                modGlobal.gv_sql = modGlobal.gv_sql + " then  ml.fieldvalue ";
                modGlobal.gv_sql = modGlobal.gv_sql + " else ml.id ";
                modGlobal.gv_sql = modGlobal.gv_sql + " end ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_misclookuplist ml ";
                modGlobal.gv_sql = modGlobal.gv_sql + " inner join tbl_setup_tabledef td on td.basetableid = ml.basetableid ";
                modGlobal.gv_sql = modGlobal.gv_sql + " where ml.lookupid = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboLookupValues, cboLookupValues.SelectedIndex);
                modGlobal.gv_rs  = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);

                modGlobal.gv_sql = "update tbl_Setup_MeasureCriteria ";
                modGlobal.gv_sql = modGlobal.gv_sql + " set fieldvalue = '" + modGlobal.gv_rs.rdoColumns["thislookupid"].Value + "'";
                modGlobal.gv_sql = modGlobal.gv_sql + " , lookupid = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboLookupValues, cboLookupValues.SelectedIndex);
                //UPGRADE_WARNING: Couldn't resolve default property of object mcid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                modGlobal.gv_sql = modGlobal.gv_sql + " where MeasureCriteriaID  = " + mcid;

                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
            }
            else if (sstMethods3.Enabled == true)
            {
                modGlobal.gv_sql = "update tbl_Setup_MeasureCriteria ";
                modGlobal.gv_sql = modGlobal.gv_sql + " set ";
                modGlobal.gv_sql = modGlobal.gv_sql + "  lookupTableid = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboLookupTables, cboLookupTables.SelectedIndex);
                //UPGRADE_WARNING: Couldn't resolve default property of object mcid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                modGlobal.gv_sql = modGlobal.gv_sql + " where MeasureCriteriaID  = " + mcid;
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
            }

            modGlobal.UpdateVerificationCriteriaTitle(mcid);


            this.Close();
        }
        private void Form_DiarioResumidoReport_Load(object sender, EventArgs e)
        {
            if (fechaFin >= fechaInicio)
            {
                try
                {
                    if (checkExcel == true)
                    {
                        reports.rptLibroDiarioExcel _rptLibroDiario = new reports.rptLibroDiarioExcel();
                        _rptLibroDiario.DataSourceConnections[0].SetConnection(objCnx.server(), objCnx.database(), objCnx.user(), objCnx.password());
                        _rptLibroDiario.SetParameterValue("@MonedaID", monedaId);
                        _rptLibroDiario.SetParameterValue("@Desde", fechaInicio.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("@Hasta", fechaFin.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("@Detallado", 0);
                        _rptLibroDiario.SetParameterValue("@EmpresaID", empresaId);
                        _rptLibroDiario.SetParameterValue("@Ejercicio", periodoId);
                        _rptLibroDiario.SetParameterValue("name_report", "Libro Diario");
                        _rptLibroDiario.SetParameterValue("date_range", fechaInicio.ToShortDateString() + " - " + fechaFin.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("currency", "Expresado en " + monedaNom);
                        _rptLibroDiario.SetParameterValue("empresa", empresa);
                        _rptLibroDiario.SetParameterValue("periodo", periodoId);
                        _rptLibroDiario.SetParameterValue("ruc", rucParam);
                        _rptLibroDiario.SetParameterValue("address", direccParam);
                        _rptLibroDiario.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                        crvLibros.ReportSource = _rptLibroDiario;
                    }
                    else
                    {
                        String Mes = "";
                        Mes = MonthName(fechaInicio.Month).ToUpper();
                        reports.rptLibroDiario _rptLibroDiario = new reports.rptLibroDiario();
                        _rptLibroDiario.DataSourceConnections[0].SetConnection(objCnx.server(), objCnx.database(), objCnx.user(), objCnx.password());
                        _rptLibroDiario.SetParameterValue("@MonedaID", monedaId);

                        _rptLibroDiario.SetParameterValue("@Desde", fechaInicio.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("@Hasta", fechaFin.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("@Detallado", 0);



                        _rptLibroDiario.SetParameterValue("@EmpresaID", empresaId);
                        _rptLibroDiario.SetParameterValue("@Ejercicio", periodoId);
                        _rptLibroDiario.SetParameterValue("name_report", "FORMATO 5.1: LIBRO DIARIO");
                        _rptLibroDiario.SetParameterValue("date_range", fechaInicio.ToShortDateString() + " - " + fechaFin.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("currency", "EXPRESADO EN " + monedaNom.ToUpper());
                        _rptLibroDiario.SetParameterValue("empresa", empresa.ToUpper());
                        _rptLibroDiario.SetParameterValue("periodo", "EJERCICIO: " + periodoId + " - " + Mes);
                        _rptLibroDiario.SetParameterValue("ruc", "RUC: " + rucParam);
                        _rptLibroDiario.SetParameterValue("address", direccParam.ToUpper());
                        _rptLibroDiario.SetParameterValue("Fecha", "FECHA:  " + DateTime.Now.ToShortDateString());
                        _rptLibroDiario.SetParameterValue("Hora", "HORA :  " + DateTime.Now.ToShortTimeString());
                        _rptLibroDiario.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                        crvLibros.ReportSource = _rptLibroDiario;
                    }
                }
                catch
                {
                    RadMessageBox.Show("Ha ocurrido un error inesperado", "Error:", MessageBoxButtons.OK, RadMessageIcon.Error);
                }
            }
            else
            {
                RadMessageBox.Show("El rango de fechas es incorrecto", "Error:", MessageBoxButtons.OK, RadMessageIcon.Error);
            }
        }
Esempio n. 6
0
        private void RadMenuItemGuardar_Click(object sender, EventArgs e)
        {
            bool modifica = RowIndex > -1;

            if (ValidaCambios(modifica))
            {
                RadMessageBox.Show("No se han realizado cambios.", "ALERTA");
                return;
            }

            if (RadMessageBox.Show("Seguro desea guardar la información suministrada?", "ALERTA", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            if (RadTxtNombre.Text == "")
            {
                RadMessageBox.Show("Debes ingresar Nombre de Producto.", "ALERTA");
                return;
            }

            if (RadTxtCodigo.Text == "")
            {
                RadMessageBox.Show("Debes ingresar Código de Producto.", "ALERTA");
                return;
            }

            if (RadDrpProveedor.SelectedIndex == -1)
            {
                RadMessageBox.Show("Debes seleccionar un Proveedor.", "ALERTA");
                return;
            }

            if (float.Parse(RadMskValorCompra.Value.ToString()) == 0)
            {
                RadMessageBox.Show("Debes ingresar el valor de Compra del Producto", "ALERTA");
                return;
            }

            if (float.Parse(RadMskValorUnidadVenta.Value.ToString()) == 0)
            {
                RadMessageBox.Show("Debes ingresar el valor de Venta Unidad del Producto.", "ALERTA");
                return;
            }

            Producto Product = new Producto();

            Product.ProductoID             = modifica ? int.Parse(dttProducto.Rows[RowIndex]["ProductoID"].ToString()) : 0;
            Product.Nombre                 = RadTxtNombre.Text;
            Product.CodigoProducto         = RadTxtCodigo.Text;
            Product.UnidadxProducto        = Convert.ToInt32(float.Parse(RadMskUnidadProducto.Value.ToString()));
            Product.ValorCompra            = Convert.ToInt32(float.Parse(RadMskValorCompra.Value.ToString()));
            Product.ValorVentaXUnidad      = Convert.ToInt32(float.Parse(RadMskValorUnidadVenta.Value.ToString()));
            Product.PorcentajeVentaPublico = Convert.ToInt32(float.Parse(RadMskPorcentaje.Value.ToString()) * 100);
            Product.DescuentoVentaInterna  = Convert.ToInt32(float.Parse(RadMskDescuento.Value.ToString()) * 100);
            Product.Insumo                 = RadChkInsumo.Checked;
            Product.Activo                 = RadChkActivo.Checked;
            Product.ProveedorID            = RadDrpProveedor.SelectedIndex > -1? int.Parse(RadDrpProveedor.SelectedValue.ToString()) : 0;

            DataSet dtsSave = Consulta.GuardaProducto(modifica, Product);

            RadMessageBox.Show(dtsSave.Tables[0].Rows[0]["Mensaje"].ToString(), "Respuesta");

            TablaProducto();

            RadMenuItemEditar.Enabled    = true;
            RadMenuItemAdicionar.Enabled = true;
            RadMenuItemGuardar.Enabled   = false;
            RadGridViewProductos.Enabled = true;
        }
Esempio n. 7
0
 private void radButton5_Click(object sender, EventArgs e)
 {
     if (this.txtRemarks.Text.Length < 40)
     {
         int num1 = (int)RadMessageBox.Show("Your request must be at least 40 characters long.");
     }
     else
     {
         this.txtTitle.Text   = this.txtTitle.Text.Trim();
         this.txtRemarks.Text = this.txtRemarks.Text.Trim();
         this.txtEmail.Text   = this.txtEmail.Text.Trim();
         string str1 = this.chkSyslog.Checked ? GClass6.smethod_18() : "No data provided";
         if (this.txtTitle.Text == "")
         {
             int num2 = (int)RadMessageBox.Show("Please provide a short description of the issue.");
         }
         else if (this.txtRemarks.Text.Length < 40)
         {
             int num3 = (int)RadMessageBox.Show("Your request must be at least 40 characters long.");
         }
         else if (!this.method_1(this.txtEmail.Text))
         {
             int num4 = (int)RadMessageBox.Show("You must specify a valid email address, otherwise we can't reply to you!");
         }
         else
         {
             string str2 = this.txtRemarks.Text.Trim() + Environment.NewLine;
             foreach (ListViewDataItem checkedItem in (ReadOnlyCollection <ListViewDataItem>) this.lstTitles.CheckedItems)
             {
                 str2 = str2 + checkedItem.Tag + Environment.NewLine;
             }
             if (this.chkTeamViewer.Checked)
             {
                 str2 = str2 + Environment.NewLine + string.Format("The user has requested a TeamViewer Session at {0}.", (object)TimeZoneInfo.ConvertTimeFromUtc(this.timeViewer.Value.ToUniversalTime(), TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time")));
             }
             if (this.string_0 != null)
             {
                 str2 = str2 + Environment.NewLine + Environment.NewLine + this.string_0;
             }
             string s = GClass6.smethod_20(string.Format("{0}/issue/open_issue.php", (object)Class67.SupportWiiUUSBHelperURL), new NameValueCollection()
             {
                 { "email", this.txtEmail.Text }, { "app_id", Settings.Default.AppId }, { "title", this.txtTitle.Text }, { "syslog", str1 }
             });
             try
             {
                 int num5 = (int)uint.Parse(s);
             }
             catch
             {
                 int num5 = (int)RadMessageBox.Show("Sorry but we are unable to process your request at the moment");
                 return;
             }
             string str3 = GClass6.smethod_20(string.Format("{0}/issue/answer_issue.php", (object)Class67.SupportWiiUUSBHelperURL), new NameValueCollection()
             {
                 { "issue_id", s }, { "message", str2 }
             });
             try
             {
                 int num5 = (int)uint.Parse(str3);
             }
             catch
             {
                 int num5 = (int)RadMessageBox.Show("Sorry but we are unable to process your request at the moment");
                 return;
             }
             foreach (string sourceFileName in this.list_0)
             {
                 try
                 {
                     string str4 = Path.Combine(GClass88.DirectoryCache, str3);
                     System.IO.File.Copy(sourceFileName, str4, true);
                     Encoding.UTF8.GetString(new WebClient().UploadFile(string.Format("{0}/issue/upload.php", (object)Class67.SupportWiiUUSBHelperURL), str4));
                 }
                 catch
                 {
                 }
             }
             int num6 = (int)RadMessageBox.Show(string.Format("<html>Thank you for contacting us!\nYou will be notified by email (make sure to check your spam box) when a reply is available.\nYour issue id is : {0}\nYou can follow its status <a href=\"{1}/issue/view/view.php?issue_id={2}\">here</a>.\nPlease keep it for future reference.<html>", (object)s, (object)Class67.SupportWiiUUSBHelperURL, (object)s));
             this.Close();
         }
     }
 }
Esempio n. 8
0
 public static void Info(string Message)
 {
     RadMessageBox.Show(Message, "Infomation", MessageBoxButtons.OK, RadMessageIcon.Info);
 }
Esempio n. 9
0
 public static void Warning(string Message)
 {
     RadMessageBox.Show(Message, "Warning", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
 }
Esempio n. 10
0
 public static void Error(string Message)
 {
     RadMessageBox.Show("Error : " + Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
 }
Esempio n. 11
0
 public static void Error(Exception ex, string Name)
 {
     RadMessageBox.Show("Error : " + ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
     //dbclass.dc._AM_Error_Save(ex.ToString(), Name, User_Id);
 }
Esempio n. 12
0
 //public static bool ToExit()
 //{
 //    return Question("Are you want to 'Exit' ?");
 //}
 public static bool ToExit()
 {
     return((RadMessageBox.Show("Are you sure you want to exit the application ?", "Exit", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) ? true : false);
 }
Esempio n. 13
0
        private bool KullaniciLoginDurum()
        {
            try
            {
                var j = new tokDBEntities1().logins.ToDictionary(x => x.kullaniciAdi);
                //-> x i key olarak atayıp, database'de uniq olan kullanıcı adı'nı da x e atadık.
                //j bütün kullanıcı adlarını çekecek.
                var uName = j[txtKullaniciAdi.Text];
                // kullanıcı adı, textboxtakiyle aynı olan üye varsa bütün bilgilerini uName değişkenine atacak.

                if (uName != null && uName.sifre == txtSifre.Text)
                {
                    KullaniciBilgi.KullaniciAdi = uName.kullaniciAdi;
                    KullaniciBilgi.KullaniciID  = uName.kullaniciID;

                    return(true);
                }
                return(false);
            }
            catch (InvalidOperationException ex)
            {
                return(false);
            }

            catch (KeyNotFoundException ex)
            {
                return(false);
            }
            catch (SqlException)
            {
                RadMessageBox.SetThemeName("TelerikMetro");
                DialogResult result = RadMessageBox.Show("Veritabanı bağlantısı yapılamadı. Bağlantıyı kontrol edip tekrar deneyiniz. ", "Bağlantı Hatası", MessageBoxButtons.RetryCancel);

                if (result == DialogResult.Retry)
                {
                    //btnGiris_Click içinde yapılan işlemler "yeniden dene" butonuna basılırsa tekrar çağırılıyor...
                    if (!KullaniciLoginDurum())
                    {
                        RadMessageBox.SetThemeName("TelerikMetro");
                        RadMessageBox.Show("Hatalı Giriş. Bilgilerinizi Kontrol Edin", "Hatalı Giriş", MessageBoxButtons.OK,
                                           RadMessageIcon.Info);
                    }
                    else
                    {
                        SqlConnection baglanti = new SqlHelper().Connection();
                        SqlCommand    komut    = new SqlCommand("beniHatirla", baglanti); // beniHatirla (stored procedure)
                        komut.CommandType = CommandType.StoredProcedure;

                        if (chkBeniHatirla.Checked)
                        {
                            komut.Parameters.AddWithValue("@beniHatirla", "true");
                            komut.Parameters.AddWithValue("@kullaniciAdi", txtKullaniciAdi.Text);

                            try
                            {
                                baglanti.Open();
                                komut.ExecuteNonQuery();
                            }

                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message.ToString());
                            }

                            finally
                            {
                                baglanti.Close();
                            }
                        }

                        this.Hide();
                        FrmRehber _frmRehber = new FrmRehber();
                        _frmRehber.ShowDialog();
                        this.Close();
                    }
                }

                return(false);
            }
        }
Esempio n. 14
0
        private void radGridView_unidadequivalente_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            int pos = 0;

            try
            {
                if (e.KeyCode == Keys.F1 || e.KeyCode == Keys.F2)
                {
                    if (radGridView_unidadequivalente.Rows.Count > 0)
                    {
                        if (radGridView_unidadequivalente.CurrentCell != null)
                        {
                            if (radGridView_unidadequivalente.CurrentCell.RowIndex != -1)
                            {
                                RadFormUnidadEquivalente radFormUnidad = new RadFormUnidadEquivalente
                                {
                                    producto = new Producto()
                                    {
                                        Idproducto = int.Parse(radText_cod.Text),
                                        Categoria  = new Categoria()
                                        {
                                            Idcategoria = int.Parse(radDrop_categoria.SelectedValue.ToString())
                                        },
                                        Nombre = radText_nombre.Text,
                                        Unidad = new UnidadMedida()
                                        {
                                            Idunidadmedida = int.Parse(radDrop_unidad.SelectedValue.ToString())
                                        },
                                        Precio = decimal.Parse(radText_precio.Text),
                                        Estado = radDrop_estado.SelectedIndex == 0 ? 1 : 0
                                    }
                                    ,
                                    unidadequivalente = new UnidadEquivalente()
                                    {
                                        Idunidadequivalente = e.KeyCode == Keys.F1 ? 0 : int.Parse(radGridView_unidadequivalente.Rows[radGridView_unidadequivalente.CurrentCell.RowIndex].Cells["idunidadequivalente"].Value.ToString()),
                                        Unidadmedida        = e.KeyCode == Keys.F1 ? new UnidadMedida()
                                        {
                                            Idunidadmedida = 0
                                        } : new UnidadMedida()
                                        {
                                            Idunidadmedida = int.Parse(radGridView_unidadequivalente.Rows[radGridView_unidadequivalente.CurrentCell.RowIndex].Cells["idunidadmedida"].Value.ToString())
                                        },
                                        Equivale = e.KeyCode == Keys.F1 ? 0.00m : decimal.Parse(radGridView_unidadequivalente.Rows[radGridView_unidadequivalente.CurrentCell.RowIndex].Cells["equivale"].Value.ToString()),
                                        Estado   = e.KeyCode == Keys.F1 ? 0 : radGridView_unidadequivalente.Rows[radGridView_unidadequivalente.CurrentCell.RowIndex].Cells["estado"].Value.ToString() == "ACTIVO" ? 0 : 1
                                    },
                                    Sesion = Sesion
                                };
                                radFormUnidad.ShowDialog();

                                Sp_listar_unidadequivalentexproducto(radGridView_producto.CurrentCell.RowIndex);
                            }
                        }
                    }
                }

                if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
                {
                    if (radGridView_unidadequivalente.Rows.Count > 0)
                    {
                        if (radGridView_unidadequivalente.CurrentCell != null)
                        {
                            if (radGridView_unidadequivalente.CurrentCell.RowIndex != -1)
                            {
                                pos = radGridView_unidadequivalente.CurrentCell.RowIndex;
                                if (e.KeyCode == Keys.Up)
                                {
                                    pos--;
                                }
                                else
                                {
                                    pos++;
                                }

                                if (pos >= 0 && pos < radGridView_unidadequivalente.Rows.Count)
                                {
                                    Sp_listar_precioxidunidadequivalente(pos);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.Show(ex.Message.ToString());
            }
        }
Esempio n. 15
0
 private void radWizard1_Help(object sender, EventArgs e)
 {
     RadMessageBox.SetThemeName(this.radWizard1.ThemeName);
     RadMessageBox.Show("You can provide your RadWizard Help using this event.", "RadWizard Help");
 }
Esempio n. 16
0
 public static void WarningIT(string Message)
 {
     RadMessageBox.Show("ไม่พบข้อมูล '" + Message + "' โปรดติดต่อแผนก IT", "Warning", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
 }
Esempio n. 17
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            oCatalogo = new WCF_Catalogos.Hersan_CatalogosClient();
            EducacionBE obj    = new EducacionBE();
            int         Result = 0;

            try {
                if (!ValidarCampos())
                {
                    RadMessageBox.Show("Debe capturar todos los datos para continuar", this.Text, MessageBoxButtons.OK, RadMessageIcon.Exclamation);
                    return;
                }

                if (oList.FindAll(item => item.Nombre.Trim() == txtNombre.Text.Trim()).Count > 0 && int.Parse(txtId.Text) == 0)
                {
                    RadMessageBox.Show("La información capturada ya existe, no es posible guardar", this.Text, MessageBoxButtons.OK, RadMessageIcon.Exclamation);
                    LimpiarCampos();
                    return;
                }

                if (RadMessageBox.Show("Desea guardar los datos capturados...?", this.Text, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    obj.Id     = int.Parse(txtId.Text);
                    obj.Nombre = txtNombre.Text;
                    obj.Abrev  = txtAbrev.Text;
                    obj.DatosUsuario.Estatus       = chkEstatus.Checked;
                    obj.DatosUsuario.IdUsuarioCreo = BaseWinBP.UsuarioLogueado.ID;

                    //PROCESO DE GUARDADO Y ACTUALIZACION
                    if (txtId.Text == "0")
                    {
                        Result = oCatalogo.ABCEducacion_Guardar(obj);
                        if (Result == 0)
                        {
                            RadMessageBox.Show("Ocurrió un error al guardar el departamento", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                        }
                        else
                        {
                            RadMessageBox.Show("Educacion guardada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                            LimpiarCampos();
                            Cargar();
                        }
                    }
                    else
                    {
                        Result = oCatalogo.ABCEducacion_Actualizar(obj);
                        if (Result == 0)
                        {
                            RadMessageBox.Show("Ocurrió un error al actualizar los datos", this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
                        }
                        else
                        {
                            RadMessageBox.Show("Información actualizada correctamente", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                            LimpiarCampos();
                            Cargar();
                        }
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrió un error al guardar los datos\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oCatalogo = null;
            }
        }
Esempio n. 18
0
 public static bool ToDel()
 {
     return((RadMessageBox.Show("Are you want to delete ?", "Question", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) ? true : false);
 }
Esempio n. 19
0
        public AppUserForm()
        {
            InitializeComponent();
            this.Text = "用户管理";
            //窗体关闭时dispose
            this.FormClosed += (s, e) => {
                if (bll != null)
                {
                    bll.Dispose();
                    bll = null;
                }
            };

            data = new Helpers.VirtualGridData <Models.AppUser> {
                Grid = this.vgMainGrid, LoadedCount = 0, PerLoadSize = 100
            };
            this.vgMainGrid.AutoSizeColumnsMode       = VirtualGridAutoSizeColumnsMode.Fill;//
            this.vgMainGrid.EnableAlternatingRowColor = true;
            this.vgMainGrid.Selection.Multiselect     = false;
            this.vgMainGrid.SelectionMode             = VirtualGridSelectionMode.FullRowSelect;
            this.vgMainGrid.AllowAddNewRow            = false;
            this.vgMainGrid.AllowEdit      = false;
            this.vgMainGrid.FilterChanged += (s, e) => { Helpers.VirtualGridDataHelper.InitalLoad <Models.AppUser>(data); };
            this.vgMainGrid.SortChanged   += (s, e) => { Helpers.VirtualGridDataHelper.InitalLoad <Models.AppUser>(data); };
            //表格删除时
            this.vgMainGrid.UserDeletedRow += (s, e) =>
            {
                DeleteEntry();
            };
            //双击编辑
            this.vgMainGrid.CellDoubleClick += (s, e) => {
                var cell = this.vgMainGrid.CurrentCell;
                if (cell == null)
                {
                    return;
                }
                if (cell.RowIndex < 0)
                {
                    return;
                }

                var current             = data.Data[cell.RowIndex];
                AppUserAddEditForm form = new AppUserAddEditForm();
                form.EditMode  = Enums.EditFormMode.Edit;
                form.DataEntry = current;


                var dr = form.ShowDialog(this);

                if (dr == DialogResult.OK)
                {
                    this.vgMainGrid.BeginUpdate();
                    data.Data[cell.RowIndex] = form.DataEntry;
                    this.vgMainGrid.EndUpdate();
                    this.vgMainGrid.SelectCell(cell.RowIndex, cell.ColumnIndex);
                }
            };

            //重置密码
            this.btnResetPassword.Click += (s, e) => {
                var cell = this.vgMainGrid.CurrentCell;
                if (cell == null)
                {
                    RadMessageBox.Show(this, "请选择一行!", "", MessageBoxButtons.OK, RadMessageIcon.Error);
                    return;
                }
                if (cell.RowIndex < 0)
                {
                    return;
                }

                var current = data.Data[cell.RowIndex];
                var dr      = RadMessageBox.Show(this, "密码将被重置为 888888,是否继续?", "", MessageBoxButtons.YesNo, RadMessageIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    int re = bll.Update <Models.AppUser>(current.Id, "Password", Helpers.EncryptDecryptHelper.GetStringMD5("888888"));
                    if (re > 0)
                    {
                        RadMessageBox.Show(this, "密码已重置为 888888,请及时更改!", "", MessageBoxButtons.OK, RadMessageIcon.Info);
                    }
                    else
                    {
                        RadMessageBox.Show(this, "重置失败!", "", MessageBoxButtons.OK, RadMessageIcon.Error);
                    }
                }
            };

            //按钮编辑
            this.btnEdit.Click += (s, e) => {
                var cell = this.vgMainGrid.CurrentCell;
                if (cell == null)
                {
                    RadMessageBox.Show(this, "请选择一行!", "", MessageBoxButtons.OK, RadMessageIcon.Error);
                    return;
                }
                if (cell.RowIndex < 0)
                {
                    return;
                }

                var current             = data.Data[cell.RowIndex];
                AppUserAddEditForm form = new AppUserAddEditForm();
                form.EditMode  = Enums.EditFormMode.Edit;
                form.DataEntry = current;
                var dr = form.ShowDialog(this);
                //form.FormClosed += (ss, ee) => { Helpers.VirtualGridDataHelper.InitalLoad<Models.UserRole>(data, syncContext); };
                if (dr == DialogResult.OK)
                {
                    this.vgMainGrid.BeginUpdate();
                    data.Data[cell.RowIndex] = form.DataEntry;
                    this.vgMainGrid.EndUpdate();
                    this.vgMainGrid.SelectCell(cell.RowIndex, cell.ColumnIndex);
                }
            };


            this.btnReLoad.Click += (s, e) => {
                Helpers.VirtualGridDataHelper.InitalLoad <Models.AppUser>(data);
            };

            this.btnAdd.Click += (s, e) => {
                AppUserAddEditForm form = new AppUserAddEditForm();
                //form.StartPosition = FormStartPosition.WindowsDefaultLocation;
                form.EditMode = Enums.EditFormMode.Add;
                var dr = form.ShowDialog(this);
                if (dr == DialogResult.OK)
                {
                    this.vgMainGrid.BeginUpdate();
                    this.data.Data.Insert(0, form.DataEntry);
                    this.vgMainGrid.RowCount++;
                    this.vgMainGrid.EndUpdate();
                    this.vgMainGrid.SelectCell(0, 0);
                }
            };

            this.btnDelete.Click += (s, e) => { DeleteEntry(); };

            Helpers.VirtualGridDataHelper.InitalLoad <Models.AppUser>(data);
        }
Esempio n. 20
0
 public static void DeleteComplete()
 {
     RadMessageBox.Show("Delete complete.", "Infomation", MessageBoxButtons.OK, RadMessageIcon.Info);
 }
Esempio n. 21
0
        private void cmdAdd_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            object newmsgid          = null;
            object thisimportfieldid = null;

            if (cboImportFields.SelectedIndex < 0 | string.IsNullOrEmpty(txtMessage.Text))
            {
                RadMessageBox.Show("Field and Message are both required to complete this action.");
                return;
            }

            modGlobal.gv_sql = "select importfieldid ";
            modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_ImportFields  ";
            modGlobal.gv_sql = modGlobal.gv_sql + " where DDID = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex);
            //UPGRADE_WARNING: Couldn't resolve default property of object gv_importsetupid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            modGlobal.gv_sql = modGlobal.gv_sql + " and importsetupid = " + modGlobal.gv_importsetupid;
            modGlobal.gv_rs  = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);

            //UPGRADE_WARNING: Couldn't resolve default property of object thisimportfieldid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            thisimportfieldid = modGlobal.gv_rs.rdoColumns["ImportFieldID"].Value;

            if (frmImportSetup.txtAction.Text == "Add Error")
            {
                //UPGRADE_WARNING: Couldn't resolve default property of object newmsgid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                newmsgid = modDBSetup.FindMaxRecID(ref "tbl_setup_ImportValidationMessage", ref "MSGID");

                modGlobal.gv_sql = "Insert into tbl_setup_ImportValidationMessage ";
                modGlobal.gv_sql = modGlobal.gv_sql + " (importfieldid, MSGID, DDID, ValidationType, Message)";
                //UPGRADE_WARNING: Couldn't resolve default property of object newmsgid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                //UPGRADE_WARNING: Couldn't resolve default property of object thisimportfieldid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                modGlobal.gv_sql = modGlobal.gv_sql + " values (" + thisimportfieldid + "," + newmsgid + ",";
                modGlobal.gv_sql = modGlobal.gv_sql + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex) + ",";
                modGlobal.gv_sql = modGlobal.gv_sql + " 'ERROR', '" + modGlobal.ConvertApastroph(txtMessage) + "')";
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                this.Close();
            }
            else if (frmImportSetup.txtAction.Text == "Edit Error")
            {
                modGlobal.gv_sql = "update tbl_setup_ImportValidationMessage ";
                modGlobal.gv_sql = modGlobal.gv_sql + " set DDID = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex);
                modGlobal.gv_sql = modGlobal.gv_sql + ", Message = '" + modGlobal.ConvertApastroph(txtMessage) + "'";
                modGlobal.gv_sql = modGlobal.gv_sql + " where msgid = " + frmImportSetup.rdcImportValError.Resultset.rdoColumns["msgid"].Value;
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                this.Close();
            }
            else if (frmImportSetup.txtAction.Text == "Add Warning")
            {
                //UPGRADE_WARNING: Couldn't resolve default property of object newmsgid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                newmsgid = modDBSetup.FindMaxRecID(ref "tbl_setup_ImportValidationMessage", ref "MSGID");

                modGlobal.gv_sql = "Insert into tbl_setup_ImportValidationMessage ";
                modGlobal.gv_sql = modGlobal.gv_sql + " (importfieldid, MSGID, DDID, ValidationType, Message)";
                //UPGRADE_WARNING: Couldn't resolve default property of object newmsgid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                //UPGRADE_WARNING: Couldn't resolve default property of object thisimportfieldid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                modGlobal.gv_sql = modGlobal.gv_sql + " values (" + thisimportfieldid + "," + newmsgid + ",";
                modGlobal.gv_sql = modGlobal.gv_sql + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex) + ",";
                modGlobal.gv_sql = modGlobal.gv_sql + " 'WARNING', '" + modGlobal.ConvertApastroph(txtMessage) + "')";
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                this.Close();
            }
            else if (frmImportSetup.txtAction.Text == "Edit Warning")
            {
                modGlobal.gv_sql = "update tbl_setup_ImportValidationMessage ";
                modGlobal.gv_sql = modGlobal.gv_sql + " set DDID = " + Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex);
                modGlobal.gv_sql = modGlobal.gv_sql + ", Message = '" + modGlobal.ConvertApastroph(txtMessage) + "'";
                modGlobal.gv_sql = modGlobal.gv_sql + " where msgid = " + frmImportSetup.rdcImportValWarning.Resultset.rdoColumns["msgid"].Value;
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                this.Close();
            }
        }
Esempio n. 22
0
 public static bool Question(string Message)
 {
     return((RadMessageBox.Show(Message, "Question", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) ? true : false);
 }
Esempio n. 23
0
 public FormHome()
 {
     InitializeComponent();
     program_title = "Fenix Webcam Manager 1.0";
     RadMessageBox.SetThemeName("TelerikMetro");
 }
Esempio n. 24
0
        private void frmImportAddValidField_Load(object sender, EventArgs e)
        {
            frmImportSetup frmImportSetupCopy   = new frmImportSetup();
            int            thisindex            = 0;
            RadLabel       dtText               = new RadLabel();
            List <Item>    itemscboImportFields = new List <Item>();


            try
            {
                cboImportFields.Items.Clear();

                modGlobal.gv_sql = "select tbl_setup_DataDef.* , tbl_setup_ImportFields.OrderNumber  ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_DataDef, tbl_setup_ImportFields  ";
                modGlobal.gv_sql = modGlobal.gv_sql + " where tbl_setup_DataDef.DDID = tbl_setup_ImportFields.DDID ";
                modGlobal.gv_sql = string.Format("{0} and tbl_setup_ImportFields.importsetupid = {1}", modGlobal.gv_sql, modGlobal.gv_importsetupid);
                modGlobal.gv_sql = modGlobal.gv_sql + " order by tbl_setup_ImportFields.OrderNumber ";
                //LDW modGlobal.gv_rs = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                const string sqlTableName2 = "tbl_setup_DataDef";
                modGlobal.gv_rs = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName2, modGlobal.gv_rs);

                //LDW while (!modGlobal.gv_rs.EOF)
                foreach (DataRow myRow1 in modGlobal.gv_rs.Tables[sqlTableName2].Rows)
                {
                    itemscboImportFields.Add(new Item(myRow1.Field <int>("DDID"), myRow1.Field <string>("FieldName")));

                    //cboImportFields.Items.Add(new ListBoxItem(myRow1.Field<string>("FieldName"),myRow1.Field<int>("DDID")).ToString());

                    if (frmImportSetupCopy.txtAction.Text == "Edit Error")
                    {
                        if (myRow1.Field <int>("DDID") == Convert.ToInt32(frmImportSetupCopy.rdcImportValError.Tables[rdcImportValErrorTable].Rows[0]["DDID"]))
                        {
                            cboImportFields.SelectedIndex = thisindex;
                        }
                    }
                    else if (frmImportSetupCopy.txtAction.Text == "Edit Warning")
                    {
                        if (myRow1.Field <int>("DDID") == Convert.ToInt32(frmImportSetupCopy.rdcImportValWarning.Tables[rdcImportValWarningTable].Rows[0]["DDID"]))
                        {
                            cboImportFields.SelectedIndex = thisindex;
                        }
                    }
                    thisindex = thisindex + 1;
                    //LDW modGlobal.gv_rs.MoveNext();
                }
                this.cboImportFields.DataSource    = itemscboImportFields;
                this.cboImportFields.DisplayMember = "Description";
                this.cboImportFields.ValueMember   = "Id";


                if (frmImportSetupCopy.txtAction.Text == "Add Error")
                {
                }
                else if (frmImportSetupCopy.txtAction.Text == "Edit Error")
                {
                    txtMessage.Text = frmImportSetupCopy.rdcImportValError.Tables[rdcImportValErrorTable].Rows[0]["Message"].ToString();
                    //gv_sql = "Select Message from tbl_setup_ImportValidationMessage  "
                    //gv_sql = gv_sql & " where msgID = " & frmImportSetupCopy.rdcImportValError.Resultset!msgid
                    //Set dtText.Recordset = gv_cn.OpenResultset(gv_sql, dbOpenSnapshot)
                    //txtMessage = dtText.Recordset!Message
                }
                else if (frmImportSetupCopy.txtAction.Text == "Add Warning")
                {
                }
                else if (frmImportSetupCopy.txtAction.Text == "Edit Warning")
                {
                    txtMessage.Text = frmImportSetupCopy.rdcImportValWarning.Tables[rdcImportValWarningTable].Rows[0]["Message"].ToString();
                }
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
Esempio n. 25
0
        private void radGridView1_CommandCellClick(object sender, EventArgs e)
        {
            string UJID;
            GridCommandCellElement cell = (GridCommandCellElement)sender;

            if (cell.CommandButton.TextElement.Text == "Ambil")
            {
                if (bool.Parse(cell.RowInfo.Cells["printed"].Value.ToString()))
                {
                    //Create UJ
                    using (sinarekDataSetTableAdapters.uangjalanTableAdapter tbl = new sinarekDataSetTableAdapters.uangjalanTableAdapter())
                    {
                        UJID = tbl.pInsertUangJalan(int.Parse(cell.RowInfo.Cells["LogID"].Value.ToString())
                                                    , cell.RowInfo.Cells["TUJUAN"].Value.ToString()
                                                    , cell.RowInfo.Cells["NOSJ"].Value.ToString()
                                                    , cell.RowInfo.Cells["SOPIRNAME"].Value.ToString()
                                                    , cell.RowInfo.Cells["MOBILNAME"].Value.ToString()
                                                    , cell.RowInfo.Cells["KERNETNAME"].Value.ToString()
                                                    , -1
                                                    , decimal.Parse(cell.RowInfo.Cells["UangJalan"].Value.ToString())
                                                    , 0, NBConfig.ValidUserName).ToString();
                    }

                    //Print Uang Jalan
                    //Print
                    DialogResult res = RadMessageBox.Show("Siapkan kertas untuk print.", "SMS - Verification"
                                                          , MessageBoxButtons.OKCancel
                                                          , RadMessageIcon.Question
                                                          , MessageBoxDefaultButton.Button2);
                    if (res == System.Windows.Forms.DialogResult.OK)
                    {
                        PrinterSettings printerSettings;
                        ReportProcessor reportProcessor;

                        rptUJ rpt = new rptUJ();
                        rpt.ReportParameters["user"].Value = NBConfig.ValidUserName;
                        rpt.ReportParameters["UJID"].Value = UJID;

                        IReportDocument iRpt = (IReportDocument)rpt;

                        iRpt.DocumentName = "UJ_" + cell.RowInfo.Cells["NOSJ"].Value.ToString() + " "
                                            + cell.RowInfo.Cells["SOPIRNAME"].Value.ToString();
                        //// PrinterSettings
                        printerSettings = new PrinterSettings();
                        try
                        {
                            InstanceReportSource reportSource = new InstanceReportSource();
                            reportSource.ReportDocument = iRpt;

                            reportProcessor = new ReportProcessor();

                            reportProcessor.PrintReport(reportSource, printerSettings);
                            using (sinarekDataSetTableAdapters.uangjalanTableAdapter tbl = new sinarekDataSetTableAdapters.uangjalanTableAdapter())
                            {
                                tbl.UpdatePrinted(1
                                                  , NBConfig.ValidUserName
                                                  , int.Parse(UJID));
                            }
                            helper.PrintLog(this.GetType().Name, rpt.Name, "Print:" + UJID);
                            this.vlappenTableAdapter.FillByTanggal(this.sinarekDataSet.vlappen, dtpTanggalLaporan.Value, "UJ");
                        }
                        catch (Exception ex)
                        {
                            helper.SysLog(this.GetType().Name, this.Text, ex.Message);
                            helper.ErrorMessage(ex.Message);
                        }
                    }
                    this.uangjalanTableAdapter.FillByNoLap(this.sinarekDataSet.uangjalan);
                    this.vujTableAdapter.FillByTanggal(this.sinarekDataSet.vuj, dtpAmbilTanggal.Value);
                }
                else
                {
                    helper.NotifMessage("Surat Jalan Belum Di Print. Uang Jalan tidak dapat di ambil.");
                }
            }
        }
Esempio n. 26
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            frmImportSetup frmImportSetupCopy = new frmImportSetup();
            int            newmsgid;
            int            thisimportfieldid;


            try
            {
                if (cboImportFields.SelectedIndex < 0 | string.IsNullOrEmpty(txtMessage.Text))
                {
                    RadMessageBox.Show("Field and Message are both required to complete this action.");
                    return;
                }

                modGlobal.gv_sql = "select importfieldid ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_ImportFields  ";
                modGlobal.gv_sql = string.Format("{0} where DDID = {1}", modGlobal.gv_sql,
                                                 Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex));
                modGlobal.gv_sql = string.Format("{0} and importsetupid = {1}", modGlobal.gv_sql, modGlobal.gv_importsetupid);
                //LDW modGlobal.gv_rs = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                const string sqlTableName1 = "tbl_setup_ImportFields";
                modGlobal.gv_rs = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName1, modGlobal.gv_rs);

                thisimportfieldid = Convert.ToInt32(modGlobal.gv_rs.Tables[sqlTableName1].Rows[0]["ImportFieldID"]);

                if (frmImportSetupCopy.txtAction.Text == "Add Error")
                {
                    newmsgid = modDBSetup.FindMaxRecID("tbl_setup_ImportValidationMessage", "MSGID");

                    modGlobal.gv_sql = "Insert into tbl_setup_ImportValidationMessage ";
                    modGlobal.gv_sql = modGlobal.gv_sql + " (importfieldid, MSGID, DDID, ValidationType, Message)";
                    modGlobal.gv_sql = string.Format("{0} values ({1},{2},", modGlobal.gv_sql, thisimportfieldid, newmsgid);
                    modGlobal.gv_sql = string.Format("{0}{1},", modGlobal.gv_sql, Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex));
                    modGlobal.gv_sql = string.Format("{0} 'ERROR', '{1}')", modGlobal.gv_sql, modGlobal.ConvertApastroph(txtMessage.Text));
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    this.Close();
                }
                else if (frmImportSetupCopy.txtAction.Text == "Edit Error")
                {
                    modGlobal.gv_sql = "update tbl_setup_ImportValidationMessage ";
                    modGlobal.gv_sql = string.Format("{0} set DDID = {1}", modGlobal.gv_sql,
                                                     Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex));
                    modGlobal.gv_sql = string.Format("{0}, Message = '{1}", modGlobal.gv_sql, modGlobal.ConvertApastroph(txtMessage.Text)) + "'";
                    modGlobal.gv_sql = modGlobal.gv_sql + " where msgid = " +
                                       frmImportSetupCopy.rdcImportValError.Tables[rdcImportValErrorTable].Rows[0]["msgid"];
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    this.Close();
                }
                else if (frmImportSetupCopy.txtAction.Text == "Add Warning")
                {
                    newmsgid = modDBSetup.FindMaxRecID("tbl_setup_ImportValidationMessage", "MSGID");

                    modGlobal.gv_sql = "Insert into tbl_setup_ImportValidationMessage ";
                    modGlobal.gv_sql = modGlobal.gv_sql + " (importfieldid, MSGID, DDID, ValidationType, Message)";
                    modGlobal.gv_sql = string.Format("{0} values ({1},{2},", modGlobal.gv_sql, thisimportfieldid, newmsgid);
                    modGlobal.gv_sql = string.Format("{0}{1},", modGlobal.gv_sql, Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex));
                    modGlobal.gv_sql = string.Format("{0} 'WARNING', '{1}')", modGlobal.gv_sql, modGlobal.ConvertApastroph(txtMessage.Text));
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    this.Close();
                }
                else if (frmImportSetupCopy.txtAction.Text == "Edit Warning")
                {
                    modGlobal.gv_sql = "update tbl_setup_ImportValidationMessage ";
                    modGlobal.gv_sql = string.Format("{0} set DDID = {1}", modGlobal.gv_sql,
                                                     Support.GetItemData(cboImportFields, cboImportFields.SelectedIndex));
                    modGlobal.gv_sql = string.Format("{0}, Message = '{1}", modGlobal.gv_sql, modGlobal.ConvertApastroph(txtMessage.Text)) + "'";
                    modGlobal.gv_sql = modGlobal.gv_sql + " where msgid = " + frmImportSetupCopy.rdcImportValError.Tables[rdcImportValErrorTable].Rows[0]["msgid"];
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
Esempio n. 27
0
        //private bool isUpdate = false;
        //private ObservableCollection<BasLayer> layerData = new ObservableCollection<BasLayer>();
        public BaseParaSettingForm()
        {
            InitializeComponent();
            this.Text         = "基础参数设置";
            this.AutoValidate = AutoValidate.EnableAllowFocusChange;//控件验证时 validating e.cancel = true 时可以 切换焦点



            InitMaterialCostGridView();
            InitMaterialGridView();
            InitLayerDataEntry();
            InitLayerGridView();
            LoadLayerData();

            this.pvSetting.SelectedPageChanged += (s, e) => {
                switch (this.pvSetting.SelectedPage.Name)
                {
                case "pvpMaterialSetting":     //物料设置
                    //InitMaterialGridView();
                    LoadMaterialData();
                    break;

                case "pvpLayerSetting":    //层数设置
                    //InitLayerDataEntry();
                    //InitLayerGridView();
                    LoadLayerData();
                    break;

                default:
                    break;
                }
            };

            this.btnMaterialReload.Click += (s, e) => {
                LoadMaterialData();
            };
            this.btnMaterialDelete.Click += (s, e) => {
                if (RadMessageBox.Show(this, "确认删除所选行?", "", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.No)
                {
                    return;
                }
                var rows = this.gvMaterial.SelectedRows;
                if (rows.Count <= 0)
                {
                    RadMessageBox.Show(this, "请选择想删除的行!", "", MessageBoxButtons.OK, RadMessageIcon.Error);
                    return;
                }
                delIds.Clear();
                foreach (var row    in rows)
                {
                    var tmp = row.DataBoundItem as QuoMaterial;
                    if (tmp != null && tmp.Id > 0)
                    {
                        delIds.Add(tmp.Id);
                    }
                }
                if (delIds.Count > 0)
                {
                    Task.Factory.StartNew(() => {
                        bll.Delete <QuoMaterial>(delIds);
                    }).ContinueWith(t => {
                        if (t.IsFaulted)
                        {
                            LoadMaterialData();
                        }
                        syncContext.Post((state) => {
                            this.gvMaterial.BeginUpdate();
                            foreach (var i in rows)
                            {
                                this.gvMaterial.Rows.Remove(i);
                            }
                            this.gvMaterial.EndUpdate();
                        }, "");
                    });
                }
            };

            //取消按钮事件
            this.btnLayerCancel.Click += (s, e) => {
                if (EditMode == Enums.EditFormMode.Add)
                {
                    this.deLayer.DataSource = new QuoLayer();
                }
                else if (EditMode == Enums.EditFormMode.Edit)
                {
                    this.deLayer.DataSource = OriLayer;
                    var cur = this.gvLayer.CurrentRow.DataBoundItem as QuoLayer;
                    ObjectHelper.CopyAllField(OriLayer, cur);
                    //this.deLayer.DataSource = OriginalLayer ;
                }
            };
            //加载按钮事件
            this.btnReLoad.Click += (s, e) => { LoadLayerData(); };
            //新增按钮事件
            this.btnLayerAdd.Click += (s, e) => {
                EditMode = Enums.EditFormMode.Add;
                this.deLayer.DataSource = new QuoLayer();
            };
            //删除按钮事件
            this.btnLayerDelete.Click += (s, e) => {
                if (RadMessageBox.Show(this, "确认删除?", "", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
                {
                    this.btnLayerDelete.Enabled = false;
                    Task.Factory.StartNew <QuoLayer>(() => {
                        var cur = this.gvLayer.CurrentRow.DataBoundItem as QuoLayer;
                        if (bll.Delete <QuoLayer>(cur.Id) > 0)
                        {
                            return(cur);
                        }
                        else
                        {
                            return(null);
                        }
                    }).ContinueWith(t => {
                        if (!t.IsFaulted && t.Result != null)
                        {
                            syncContext.Post((state) => {
                                this.gvLayer.BeginUpdate();
                                var layerData = this.gvLayer.DataSource as ObservableCollection <QuoLayer>;
                                layerData.Remove(t.Result);
                                this.gvLayer.EndUpdate();
                            }, "");
                        }
                        syncContext.Post((state) => {
                            this.btnLayerDelete.Enabled = true;
                        }, "");
                    });
                }
            };
            //保存按钮事件
            this.btnLayerSave.Click += (s, e) => {
                var t = ValidationHelper.hasValidationErrors(this.deLayer.Controls);

                if (t)
                {
                    return;
                }
                this.btnLayerSave.Enabled = false;
                Task.Factory.StartNew <QuoLayer>(() => {
                    QuoLayer re = null;
                    if (EditMode == Enums.EditFormMode.Add)
                    {
                        re = bll.Insert <QuoLayer>(this.deLayer.CurrentObject as QuoLayer);
                    }
                    else if (EditMode == Enums.EditFormMode.Edit)
                    {
                        re       = bll.Update(this.deLayer.CurrentObject as QuoLayer);
                        OriLayer = re;
                    }
                    return(re);
                }).ContinueWith(tt => {
                    if (!tt.IsFaulted)
                    {
                        syncContext.Post((state) => {
                            if (tt.Result != null)
                            {
                                this.gvLayer.BeginUpdate();
                                if (EditMode == Enums.EditFormMode.Add)
                                {
                                    var layerData = this.gvLayer.DataSource as ObservableCollection <QuoLayer>;
                                    layerData.Insert(0, tt.Result);
                                }
                                else if (EditMode == Enums.EditFormMode.Edit)
                                {
                                    var layerData = this.gvLayer.DataSource as ObservableCollection <QuoLayer>;
                                    var cur       = this.gvLayer.CurrentRow.DataBoundItem as QuoLayer;
                                    //cur = tt.Result;
                                    layerData[layerData.IndexOf(cur)] = tt.Result;
                                }

                                this.gvLayer.EndUpdate();

                                if (EditMode == Enums.EditFormMode.Add)
                                {
                                    this.gvLayer.Rows[0].IsCurrent = true;
                                }
                            }
                        }, "");
                    }
                    syncContext.Post((state) => {
                        this.btnLayerSave.Enabled = true;
                    }, "");
                });
            };
        }
Esempio n. 28
0
 private void radWizard1_Cancel(object sender, EventArgs e)
 {
     RadMessageBox.SetThemeName(this.radWizard1.ThemeName);
     RadMessageBox.Show("You can implement your RadWizard Canceling logic using this event.", "RadWizard Cancel");
 }
Esempio n. 29
0
        private void InitMaterialGridView()
        {
            this.gvMaterial.AddNewRowPosition = SystemRowPosition.Top;
            this.gvMaterial.EnableFiltering   = true;
            this.gvMaterial.AllowAddNewRow    = true;
            this.gvMaterial.AllowSearchRow    = true;

            //验证
            this.gvMaterial.CellValidating += (s, e) => {
                GridViewDataColumn column = e.Column as GridViewDataColumn;
                if ((e.Row is GridViewNewRowInfo || e.Row is GridViewDataRowInfo) && column != null && column.Name == "MaterialName")//物料名称
                {
                    if (string.IsNullOrEmpty((string)e.Value) || ((string)e.Value).Trim() == string.Empty)
                    {
                        e.Cancel        = true;
                        e.Row.ErrorText = "Validation error!";
                        //((GridViewDataRowInfo)e.Row).ErrorText = "Validation error!";
                    }
                    else
                    {
                        e.Row.ErrorText = string.Empty;
                    }
                }
            };

            this.gvMaterial.UserDeletingRow += (s, e) => {
                if (RadMessageBox.Show(this, "确认删除所选行?", "", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }
                if (e.Rows != null && e.Rows.Count() > 0)
                {
                    delIds.Clear();
                    foreach (var row in e.Rows)
                    {
                        var tmp = row.DataBoundItem as QuoMaterial;
                        if (tmp != null && tmp.Id > 0)
                        {
                            delIds.Add(tmp.Id);
                        }
                    }
                }
            };

            this.gvMaterial.UserDeletedRow += (s, e) => {
                if (delIds != null && delIds.Count > 0)
                {
                    Task.Factory.StartNew(() => {
                        bll.Delete <QuoMaterial>(delIds);
                    }).ContinueWith(t => {
                        if (t.IsFaulted)
                        {
                            syncContext.Post((state) => {
                                LoadMaterialData();
                            }, null);
                        }
                    });
                }
            };

            this.gvMaterial.UserAddedRow += (s, e) => {
                var tmp = e.Row.DataBoundItem as QuoMaterial;
                if (tmp != null)
                {
                    Task.Factory.StartNew <QuoMaterial>(() => {
                        return(bll.Insert(tmp));
                    }).ContinueWith(t => {
                        syncContext.Post((state) => {
                            LoadMaterialData();
                        }, null);

                        //if (!t.IsFaulted && t.Result!=null)
                        //{
                        //    syncContext.Post((state) => {
                        //        this.gvMaterial.BeginUpdate();
                        //        ObjectHelper.CopyAllField(t.Result, tmp);

                        //        this.gvMaterial.EndUpdate();
                        //    },"");

                        //}
                        //if (t.IsFaulted || t.Result == null)
                        //{
                        //    this.gvMaterial.BeginUpdate();
                        //    var ds = this.gvMaterial.DataSource as BindingList<BasMaterial>;
                        //    ds.Remove(tmp);
                        //    this.gvMaterial.EndUpdate();
                        //}
                    });
                }
            };

            this.gvMaterial.CurrentRowChanged += (s, e) => {
                LoadMaterialCostData();
            };

            this.gvMaterial.RowsChanging += (s, e) => {
                if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanging)
                {
                    var cur = e.GridViewTemplate.MasterTemplate.CurrentRow.DataBoundItem as QuoMaterial;
                    if (cur != null)
                    {
                        Task.Factory.StartNew(() => {
                            //return false;
                            return(bll.Update <QuoMaterial>(cur.Id, e.PropertyName, e.NewValue) > 0);
                        }).ContinueWith(t => {
                            if (t.IsFaulted || !t.Result)
                            {
                                syncContext.Post((sta) =>
                                {
                                    this.gvMaterial.BeginUpdate();
                                    ModelHelper.SetValueByPropertyName(cur, e.PropertyName, e.OldValue);
                                    this.gvMaterial.EndUpdate();
                                }, "");
                            }
                        });
                    }
                }
            };
        }
Esempio n. 30
0
        private void radButton_guardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (radText_cod.Text.Length == 0)
                {
                    if (radDrop_categoria.SelectedValue != null &&
                        radText_nombre.Text.Length > 0 &&
                        radDrop_unidad.SelectedValue != null &&
                        radText_precio.Text.Length > 0)
                    {
                        if (Es_numero(radText_precio.Text))
                        {
                            if (decimal.Parse(radText_precio.Text) >= 0)
                            {
                                DialogResult respuesta = RadMessageBox.Show("¿Desea registrar producto?...", "Advertencia", MessageBoxButtons.YesNo, RadMessageIcon.Question);

                                if (respuesta == DialogResult.Yes)
                                {
                                    if (txtOrden.Text == "" || Convert.ToInt32(txtOrden.Text) == 0)
                                    {
                                        RadMessageBox.Show("Ingrese N° de orden para impresión de producto", "Advertencia");
                                        return;
                                    }
                                    else
                                    {
                                        Sp_registar_producto();
                                    }
                                }
                            }
                            else
                            {
                                RadMessageBox.Show("Precio no puede ser un número negativo...", "Advertencia");
                            }
                        }
                        else
                        {
                            RadMessageBox.Show("Precio no es un número...", "Advertencia");
                        }
                    }
                    else
                    {
                        RadMessageBox.Show("Por favor complete la información solicitada...", "Advertencia");
                    }
                }
                else
                {
                    if (radDrop_categoria.SelectedValue != null &&
                        radText_nombre.Text.Length > 0 &&
                        radDrop_unidad.SelectedValue != null &&
                        radText_precio.Text.Length > 0)
                    {
                        if (Es_numero(radText_precio.Text))
                        {
                            if (decimal.Parse(radText_precio.Text) >= 0)
                            {
                                DialogResult respuesta = RadMessageBox.Show("¿Desea actualizar producto?...", "Advertencia", MessageBoxButtons.YesNo, RadMessageIcon.Question);

                                if (respuesta == DialogResult.Yes)
                                {
                                    Sp_actualizar_producto();
                                }
                            }
                            else
                            {
                                RadMessageBox.Show("Precio no puede ser un número negativo...", "Advertencia");
                            }
                        }
                        else
                        {
                            RadMessageBox.Show("Precio no es un número...", "Advertencia");
                        }
                    }
                    else
                    {
                        RadMessageBox.Show("Por favor complete la información solicitada...", "Advertencia");
                    }
                }
            }
            catch (Exception ex)
            {
                RadMessageBox.Show(ex.Message.ToString());
            }
        }