protected void CmbOperationSetValues(int idTypeOperation)
        {
            ASPxComboBox operationComboBox = gridFondMove.FindEditFormTemplateControl("cmpOperation") as ASPxComboBox;
            if (operationComboBox == null)
                throw new Exception("Не удалось получить поле ввода операций.");

            var fondMoveEditorActions = new FondMoveEditorActions();
            operationComboBox.DataSource = fondMoveEditorActions.GetOperationSelectedTypeOperation(idTypeOperation);
            operationComboBox.DataBind();

            if (!gridFondMove.IsNewRowEditing)//При изменении элемента, выделяем выбранный в ComboBox
            {
                if (gridFondMove.GetDataRow(gridFondMove.EditingRowVisibleIndex)["IdOperation"] != null)
                {
                    int operationId =
                        Convert.ToInt32(gridFondMove.GetDataRow(gridFondMove.EditingRowVisibleIndex)["IdOperation"]);
                    if (operationComboBox.Items.FindByValue(operationId.ToString()) != null)
                        operationComboBox.Items.FindByValue(operationId.ToString()).Selected = true;
                }
            }
        }
 public static int GetIdTypeOperation(string nameOperation)
 {
     var fondMoveEditorActions = new FondMoveEditorActions();
     return fondMoveEditorActions.GetIdTypeOperation(nameOperation);
 }
 public static string CheckExistsInventoryInDb(string inventory,int idArm)
 {
     var fondMoveEditorActions = new FondMoveEditorActions();
     return fondMoveEditorActions.FondExists(inventory, idArm).ToString();
 }
        protected void gridFondMove_OnRowDeleting(object sender, ASPxDataDeletingEventArgs e)
        {
            int idFondMoveDetails = Convert.ToInt32(e.Keys["IdFondMoveDetail"]);
            var fondMoveEditorAction = new FondMoveEditorActions();

            string result = fondMoveEditorAction.FondMoveEditorDelete(idFondMoveDetails);
            gridFondMove.JSProperties["cpFondMoveEditorResultInfo"] = result;

            e.Cancel = true;
            gridFondMove.CancelEdit();
        }
        protected void gridFondMove_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            int idFondMoveDetails = Convert.ToInt32(e.Keys["IdFondMoveDetail"]);
            decimal balanceCost = e.NewValues["BalanceCost"] != null ? Convert.ToDecimal(e.NewValues["BalanceCost"]) : 0;
            decimal iznos = e.NewValues["Iznos"] != null ? Convert.ToDecimal(e.NewValues["Iznos"]) : 0;
            string comment = e.NewValues["Comment"] != null ? e.NewValues["Comment"].ToString() : "";

            var fondMoveEditorAction = new FondMoveEditorActions();
            string result = fondMoveEditorAction.FondMoveEditorEdit(idFondMoveDetails, balanceCost, iznos, comment);
            gridFondMove.JSProperties["cpFondMoveEditorResultInfo"] = result;
            
            e.Cancel = true;
            gridFondMove.CancelEdit();
        }
        protected void gridFondMove_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
        {

            var fondMoveEditorParams = SetFondMoveEditorParamsFromControls();

            var fondMoveEditorAction = new FondMoveEditorActions();
            string result = fondMoveEditorAction.FondMoveEditorInsert(fondMoveEditorParams);

            gridFondMove.JSProperties["cpFondMoveEditorResultInfo"] = result;

            e.Cancel = true;
            gridFondMove.CancelEdit();
            
        }