Example #1
0
        protected void clbPanelDistributorsManage_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            try
            {
                if (string.IsNullOrEmpty(e.Parameter))
                {
                    // remove selected distributors
                    List <object> keyValues = gridDistributorsManage.GetSelectedFieldValues("ID");
                    foreach (object key in keyValues)
                    {
                        CanonDistributor.DeleteDistributorById(int.Parse(key.ToString()));
                    }
                }

                this.BindData();
            }
            catch (ImportAssignedException iex)
            {
                clbPanelDistributorsManage.JSProperties["cpDisDeleteError"] = iex.Message;
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }
            finally
            {
                gridDistributorsManage.Selection.UnselectAll();
            }
        }
Example #2
0
        protected void gridDistributorsManage_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            try
            {
                CanonDistributor.DeleteDistributorById(int.Parse(e.Keys[0].ToString()));
            }
            catch (ImportAssignedException iex)
            {
                gridDistributorsManage.JSProperties["cpDisDeleteError"] = iex.Message;
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }

            e.Cancel = true;
            gridDistributorsManage.CancelEdit();
            this.BindData();
        }
Example #3
0
        protected void gridDistributorsManage_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            try
            {
                SessionManager.IsEditFormCreated = false;

                CanonDistributor cd = new CanonDistributor();
                cd.ID                = -1;
                cd.FileAs            = e.NewValues["FileAs"].ToString();
                cd.Note              = e.NewValues["Note"].ToString();
                cd.IDDistributorType = int.Parse(Utilities.GetEditFormComboValue(gridDistributorsManage, "cboType").ToString());
                cd.ShowInImports     = true;
                cd.ShowInReports     = true;
                CanonDistributor.InsertOrUpdateDistributor(cd);

                e.Cancel = true;
                gridDistributorsManage.CancelEdit();
                this.BindData();
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }
        }