Beispiel #1
0
        private void radGridView1_CellEndEdit(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
        {
            try
            {
                e.Row.Cells["dgvC"].Value = true;
                //string check1 = Convert.ToString(radGridView1.Rows[e.RowIndex].Cells["VendorName"].Value);
                //string TM= Convert.ToString(radGridView1.Rows[e.RowIndex].Cells["dgvCodeTemp2"].Value);
                //if (!check1.Trim().Equals("") && TM.Equals(""))
                //{

                //    if (!CheckDuplicate(check1.Trim()))
                //    {
                //        MessageBox.Show("ชื้อผู้ขายซ้ำ ซ้ำ");
                //        radGridView1.Rows[e.RowIndex].Cells["GroupCode"].Value = "";
                //        radGridView1.Rows[e.RowIndex].Cells["GroupCode"].IsSelected = true;

                //    }
                //}
                if (dgvData.Columns["Department"].Index == e.ColumnIndex)
                {
                    var    cc             = e.Row.Cells["Department"];
                    string DepartmentTemp = Convert.ToString(e.Row.Cells["Department"].Value);
                    try
                    {
                        if (!DepartmentTemp.Equals(Department_Edit) && !Department_Edit.Equals(""))
                        {
                            (e.Row.Cells["Department"].Value) = Department_Edit;
                            Department_Edit = "";
                        }
                    }
                    catch { }
                }



                if (e.RowIndex == -1)
                {
                    SendKeys.Send("{ENTER}");
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Beispiel #2
0
        private void radGridView1_CellEndEdit(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
        {
            try
            {
                e.Row.Cells["dgvC"].Value = true;
                //string check1 = Convert.ToString(radGridView1.Rows[e.RowIndex].Cells["VendorName"].Value);
                //string TM= Convert.ToString(radGridView1.Rows[e.RowIndex].Cells["dgvCodeTemp2"].Value);
                //if (!check1.Trim().Equals("") && TM.Equals(""))
                //{

                //    if (!CheckDuplicate(check1.Trim()))
                //    {
                //        MessageBox.Show("ชื้อผู้ขายซ้ำ ซ้ำ");
                //        radGridView1.Rows[e.RowIndex].Cells["GroupCode"].Value = "";
                //        radGridView1.Rows[e.RowIndex].Cells["GroupCode"].IsSelected = true;

                //    }
                //}
                if (dgvData.Columns["Department"].Index == e.ColumnIndex)
                {
                    var    cc             = e.Row.Cells["Department"];
                    string DepartmentTemp = Convert.ToString(e.Row.Cells["Department"].Value);
                    try
                    {
                        if (!DepartmentTemp.Equals(Department_Edit) && !Department_Edit.Equals(""))
                        {
                            (e.Row.Cells["Department"].Value) = Department_Edit;
                            Department_Edit = "";
                        }
                    }
                    catch { }
                }
                else if (!dbClss.TSt(dgvData.CurrentRow.Cells["Browse"].Value).Equals(""))
                {
                    string PathAttachFile = dbClss.TSt(dgvData.CurrentRow.Cells["Browse"].Value);
                    string Extension      = Path.GetExtension(PathAttachFile);
                    if (!Extension.ToUpper().Equals(".JPEG") &&
                        !Extension.ToUpper().Equals(".JPG"))
                    {
                        dgvData.CurrentRow.Cells["Browse"].Value = null;
                    }
                    else
                    {
                        System.IO.FileInfo sizex = new System.IO.FileInfo(PathAttachFile);
                        if (!(sizex.Length > 1024857))
                        {
                            dgvData.CurrentRow.Cells["Browse"].Value = PathAttachFile;
                        }
                        else
                        {
                            MessageBox.Show("Size Limit 1 MB");
                            dgvData.CurrentRow.Cells["Browse"].Value = null;
                        }
                    }
                }



                if (e.RowIndex == -1)
                {
                    SendKeys.Send("{ENTER}");
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }