コード例 #1
0
 private void btnReCalc_Click(object sender, System.EventArgs e)
 {
     ObjectList<ServiceOld> selectedServices = this.vwServiceSearch.SelectedServices;
     ObjectList<LocalAddress> selectedAddresses = ((OperationGroupForm) base.Parent.Parent.Parent.Parent.Parent).GetSelectedAddresses();
     FasetItem selectedFasetItem = this.selectReCalc.SelectedFasetItem;
     OrgDocument selectedOrgDocument = this.selectOrgDocument.SelectedOrgDocument;
     System.Text.StringBuilder builder = new System.Text.StringBuilder();
     if (this.datePeriod.DateBeginIsNull)
     {
         builder.AppendLine("Введите дату начала периода");
     }
     if (this.datePeriod.DateEndIsNull)
     {
         builder.AppendLine("Введите дату конца периода");
     }
     if ((selectedFasetItem == FasetItem.Null) || (selectedFasetItem == null))
     {
         builder.AppendLine("Выберите причину перерасчета");
     }
     if (builder.get_Length() != 0)
     {
         BalloonWindow.Show(this.btnReCalc, builder.ToString());
     }
     else
     {
         Area @null;
         if (selectedAddresses.get_Count() == 0)
         {
             if (Messages.QuestionYesNo(this, "Вы не выбрали адреса. Перерасчёт без ограниения по адресу может занять продолжительное время.\nВы уверены что хотите продолжить?") != System.Windows.Forms.DialogResult.Yes)
             {
                 return;
             }
             @null = Area.Null;
         }
         else
         {
             @null = new Area();
             @null.SaveChanges();
             @null.SaveAddresses(selectedAddresses);
         }
         if ((selectedServices.get_Count() != 0) || (Messages.QuestionYesNo(this, "Вы не выбрали услуги. Будет произведён перерасчёт по всем услугам, который может занять продолжительное время.\nВы уверены что хотите продолжить?") == System.Windows.Forms.DialogResult.Yes))
         {
             bool isRecalc = true;
             if (this.rbCharge.get_Checked())
             {
                 isRecalc = false;
             }
             this.set_Cursor(System.Windows.Forms.Cursors.WaitCursor);
             try
             {
                 GroupOperation.RecalcAccountServices(selectedServices, selectedFasetItem.Id, this.datePeriod.DateBegin, this.datePeriod.DateEnd, selectedOrgDocument, @null, this.chbxWithBankrupt.get_Checked(), isRecalc);
             }
             catch (System.Exception exception)
             {
                 Messages.ShowException(this, exception);
             }
             finally
             {
                 this.set_Cursor(System.Windows.Forms.Cursors.Default);
             }
             Messages.ShowMessage("Групповой перерасчет был выполнен для " + ((selectedServices.get_Count() == 0) ? ((string) " всех ") : ((int) selectedServices.get_Count()).ToString()) + " услуг!");
             @null.DeleteWithRelations();
         }
     }
 }
コード例 #2
0
ファイル: DALSql.cs プロジェクト: u4097/SQLScript
 public static string GetSqlScriptCreateTempTable(System.Collections.IDictionary items, string tempTableName)
 {
     tempTableName = tempTableName.Trim();
     if (!tempTableName.StartsWith("#"))
     {
         tempTableName = "#" + tempTableName;
     }
     System.Text.StringBuilder builder = new System.Text.StringBuilder();
     foreach (System.Collections.DictionaryEntry entry in items)
     {
         string str;
         if (entry.get_Key() is ObjectWithId)
         {
             ObjectWithId id = entry.get_Key() as ObjectWithId;
             if (id == null)
             {
                 continue;
             }
             str = ((long) id.Id).ToString();
         }
         else
         {
             str = entry.get_Key().ToString();
         }
         if (builder.get_Length() > 0)
         {
             builder.AppendLine(" union all");
         }
         builder.AppendFormat("select {0} id, ", str);
         if (entry.get_Value() == null)
         {
             builder.Append("null");
         }
         else if (entry.get_Value() is string)
         {
             builder.AppendFormat("'{0}'", entry.get_Value().ToString().Replace("'", "''"));
         }
         else
         {
             builder.Append(entry.get_Value());
         }
         builder.Append(" value");
     }
     builder.Insert(0, "\r\n\t\t\t\tselect id, value\r\n\t\t\t\tinto " + tempTableName + "\r\n\t\t\t\tfrom (\r\n\t\t\t\t\t");
     builder.AppendLine(") t");
     string sqlScriptDropTempTable = GetSqlScriptDropTempTable(tempTableName);
     builder.Insert(0, sqlScriptDropTempTable);
     return builder.ToString();
 }
コード例 #3
0
ファイル: OrgDocument.cs プロジェクト: u4097/SQLScript
 public override string ToString()
 {
     System.Text.StringBuilder builder = new System.Text.StringBuilder();
     if (base.Type != null)
     {
         builder.Append(base.Type.Name);
     }
     if (base.Number != string.Empty)
     {
         if (builder.get_Length() != 0)
         {
             builder.Append(" ");
         }
         builder.Append(base.Number);
     }
     builder.Append(" от  ");
     builder.Append(base.WhenGet.ToShortDateString());
     if (this.Organization != null)
     {
         if (builder.get_Length() != 0)
         {
             builder.Append(", ");
         }
         builder.Append(this.Organization.ShortName);
     }
     if (this.comment != string.Empty)
     {
         builder.Append(" (" + this.comment + ")");
     }
     return builder.ToString();
 }
コード例 #4
0
ファイル: OpenOperationView.cs プロジェクト: u4097/SQLScript
 private void btnOpenService_Click(object sender, System.EventArgs e)
 {
     ObjectList<ServiceOld> selectedServices = this.vwServiceSearchOpen.SelectedServices;
     ObjectList<LocalAddress> selectedAddresses = ((OperationGroupForm) base.Parent.Parent.Parent.Parent.Parent).GetSelectedAddresses();
     OrgDocument selectedOrgDocument = this.selectOrgDocument.SelectedOrgDocument;
     System.Text.StringBuilder builder = new System.Text.StringBuilder();
     bool openInCloseAccount = this.chAccountClose.get_Checked() ? ((bool) true) : ((bool) false);
     if (selectedServices.get_Count() == 0)
     {
         builder.AppendLine("Выберите услуги");
     }
     if (this.dbxOpenDate.IsNull)
     {
         builder.AppendLine("Введите дату открытия");
     }
     if ((this.dbxCloseDate.Value != Constants.NullDate) && (this.dbxCloseDate.Value <= this.dbxOpenDate.Value))
     {
         builder.AppendLine("Введите корректную дату окончания услуг");
     }
     if (builder.get_Length() != 0)
     {
         BalloonWindow.Show(this.btnOpenService, builder.ToString());
     }
     else if ((selectedAddresses.get_Count() != 0) || (Messages.QuestionYesNo(this, "Вы не выбрали адреса!\nОперация будет произведена для всего адресного плана.\nВы уверены, что хотите продолжить?") == System.Windows.Forms.DialogResult.Yes))
     {
         Organization organization = this.selectHouseHolder.SelectedOrganizationOld ?? Organization.Null;
         Organization organization2 = this.selectAccountHouseHolder.SelectedOrganizationOld ?? Organization.Null;
         foreach (ServiceOld old in selectedServices)
         {
             GroupOperation.OpenAccountService(old.Id, this.dbxOpenDate.Value, this.dbxCloseDate.Value, selectedOrgDocument, this.selectTypes.SelectedFasetItem, selectedAddresses, organization.Id, organization2.Id, openInCloseAccount);
         }
         Messages.ShowMessage("Групповая операция по открытию услуги выполнена");
     }
 }